diff --git a/rust/ql/lib/codeql/rust/elements/internal/TupleStructPatImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/TupleStructPatImpl.qll index d7d4f02f81e4..38259efadb74 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/TupleStructPatImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/TupleStructPatImpl.qll @@ -34,6 +34,11 @@ module Impl { exists(this.getField(pragma[only_bind_into](pos))) } + /** + * Gets the struct matched by this pattern. + */ + Struct getStruct() { result = PathResolution::resolvePath(this.getPath()) } + /** Gets the tuple field that matches the `pos`th pattern of this pattern. */ pragma[nomagic] TupleField getTupleField(int pos) { diff --git a/rust/ql/lib/codeql/rust/frameworks/Poem.qll b/rust/ql/lib/codeql/rust/frameworks/Poem.qll index 66c01a415a1c..2554d8452939 100644 --- a/rust/ql/lib/codeql/rust/frameworks/Poem.qll +++ b/rust/ql/lib/codeql/rust/frameworks/Poem.qll @@ -4,7 +4,6 @@ private import rust private import codeql.rust.Concepts -private import codeql.rust.dataflow.DataFlow /** * Parameters of a handler function @@ -12,9 +11,8 @@ private import codeql.rust.dataflow.DataFlow private class PoemHandlerParam extends RemoteSource::Range { PoemHandlerParam() { exists(TupleStructPat param | - param.getResolvedPath() = ["crate::web::query::Query", "crate::web::path::Path"] - | - this.asPat().getPat() = param.getAField() + this.asPat().getPat() = param.getAField() and + param.getStruct().getCanonicalPath() = ["poem::web::query::Query", "poem::web::path::Path"] ) } }