Skip to content

Commit 28d3f9b

Browse files
authored
Merge pull request #19801 from geoffw0/poem
Rust: Update PoemHandlerParam to use getCanonicalPath
2 parents 93c891a + b40bd75 commit 28d3f9b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

rust/ql/lib/codeql/rust/elements/internal/TupleStructPatImpl.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ module Impl {
3434
exists(this.getField(pragma[only_bind_into](pos)))
3535
}
3636

37+
/**
38+
* Gets the struct matched by this pattern.
39+
*/
40+
Struct getStruct() { result = PathResolution::resolvePath(this.getPath()) }
41+
3742
/** Gets the tuple field that matches the `pos`th pattern of this pattern. */
3843
pragma[nomagic]
3944
TupleField getTupleField(int pos) {

rust/ql/lib/codeql/rust/frameworks/Poem.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44

55
private import rust
66
private import codeql.rust.Concepts
7-
private import codeql.rust.dataflow.DataFlow
87

98
/**
109
* Parameters of a handler function
1110
*/
1211
private class PoemHandlerParam extends RemoteSource::Range {
1312
PoemHandlerParam() {
1413
exists(TupleStructPat param |
15-
param.getResolvedPath() = ["crate::web::query::Query", "crate::web::path::Path"]
16-
|
17-
this.asPat().getPat() = param.getAField()
14+
this.asPat().getPat() = param.getAField() and
15+
param.getStruct().getCanonicalPath() = ["poem::web::query::Query", "poem::web::path::Path"]
1816
)
1917
}
2018
}

0 commit comments

Comments
 (0)