Skip to content

Rust: Update PoemHandlerParam to use getCanonicalPath #19801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 2 additions & 4 deletions rust/ql/lib/codeql/rust/frameworks/Poem.qll
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@

private import rust
private import codeql.rust.Concepts
private import codeql.rust.dataflow.DataFlow

/**
* Parameters of a handler function
*/
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"]
)
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
multipleMethodCallTargets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should just revert this file to get green CI.

| main.rs:187:13:187:43 | ...::System.allocate(...) | file://:0:0:0:0 | fn allocate |
| main.rs:187:13:187:43 | ...::System.allocate(...) | file://:0:0:0:0 | fn allocate |
| main.rs:188:13:188:50 | ...::System.allocate_zeroed(...) | file://:0:0:0:0 | fn allocate_zeroed |
| main.rs:188:13:188:50 | ...::System.allocate_zeroed(...) | file://:0:0:0:0 | fn allocate_zeroed |
| main.rs:195:13:195:43 | ...::System.allocate(...) | file://:0:0:0:0 | fn allocate |
| main.rs:195:13:195:43 | ...::System.allocate(...) | file://:0:0:0:0 | fn allocate |
| main.rs:196:13:196:50 | ...::System.allocate_zeroed(...) | file://:0:0:0:0 | fn allocate_zeroed |
| main.rs:196:13:196:50 | ...::System.allocate_zeroed(...) | file://:0:0:0:0 | fn allocate_zeroed |
| main.rs:208:21:208:55 | ...::System.grow(...) | file://:0:0:0:0 | fn grow |
| main.rs:208:21:208:55 | ...::System.grow(...) | file://:0:0:0:0 | fn grow |
| main.rs:210:21:210:62 | ...::System.grow_zeroed(...) | file://:0:0:0:0 | fn grow_zeroed |
| main.rs:210:21:210:62 | ...::System.grow_zeroed(...) | file://:0:0:0:0 | fn grow_zeroed |
| main.rs:213:17:213:53 | ...::System.shrink(...) | file://:0:0:0:0 | fn shrink |
| main.rs:213:17:213:53 | ...::System.shrink(...) | file://:0:0:0:0 | fn shrink |
multiplePathResolutions
| main.rs:218:14:218:17 | libc | file://:0:0:0:0 | Crate([email protected].172) |
| main.rs:218:14:218:17 | libc | file://:0:0:0:0 | Crate([email protected].171) |
| main.rs:218:14:218:17 | libc | file://:0:0:0:0 | Crate([email protected]) |
| main.rs:218:14:218:25 | ...::malloc | file://:0:0:0:0 | fn malloc |
| main.rs:218:14:218:25 | ...::malloc | file://:0:0:0:0 | fn malloc |
| main.rs:219:13:219:16 | libc | file://:0:0:0:0 | Crate([email protected].172) |
| main.rs:219:13:219:16 | libc | file://:0:0:0:0 | Crate([email protected].171) |
| main.rs:219:13:219:16 | libc | file://:0:0:0:0 | Crate([email protected]) |
| main.rs:219:13:219:24 | ...::malloc | file://:0:0:0:0 | fn malloc |
| main.rs:219:13:219:24 | ...::malloc | file://:0:0:0:0 | fn malloc |
| main.rs:220:13:220:16 | libc | file://:0:0:0:0 | Crate([email protected].172) |
| main.rs:220:13:220:16 | libc | file://:0:0:0:0 | Crate([email protected].171) |
| main.rs:220:13:220:16 | libc | file://:0:0:0:0 | Crate([email protected]) |
| main.rs:220:13:220:31 | ...::aligned_alloc | file://:0:0:0:0 | fn aligned_alloc |
| main.rs:220:13:220:31 | ...::aligned_alloc | file://:0:0:0:0 | fn aligned_alloc |
| main.rs:221:13:221:16 | libc | file://:0:0:0:0 | Crate([email protected].172) |
| main.rs:221:13:221:16 | libc | file://:0:0:0:0 | Crate([email protected].171) |
| main.rs:221:13:221:16 | libc | file://:0:0:0:0 | Crate([email protected]) |
| main.rs:221:13:221:31 | ...::aligned_alloc | file://:0:0:0:0 | fn aligned_alloc |
| main.rs:221:13:221:31 | ...::aligned_alloc | file://:0:0:0:0 | fn aligned_alloc |
| main.rs:222:13:222:16 | libc | file://:0:0:0:0 | Crate([email protected].172) |
| main.rs:222:13:222:16 | libc | file://:0:0:0:0 | Crate([email protected].171) |
| main.rs:222:13:222:16 | libc | file://:0:0:0:0 | Crate([email protected]) |
| main.rs:222:13:222:24 | ...::calloc | file://:0:0:0:0 | fn calloc |
| main.rs:222:13:222:24 | ...::calloc | file://:0:0:0:0 | fn calloc |
| main.rs:223:13:223:16 | libc | file://:0:0:0:0 | Crate([email protected].172) |
| main.rs:223:13:223:16 | libc | file://:0:0:0:0 | Crate([email protected].171) |
| main.rs:223:13:223:16 | libc | file://:0:0:0:0 | Crate([email protected]) |
| main.rs:223:13:223:24 | ...::calloc | file://:0:0:0:0 | fn calloc |
| main.rs:223:13:223:24 | ...::calloc | file://:0:0:0:0 | fn calloc |
| main.rs:224:13:224:16 | libc | file://:0:0:0:0 | Crate([email protected].172) |
| main.rs:224:13:224:16 | libc | file://:0:0:0:0 | Crate([email protected].171) |
| main.rs:224:13:224:16 | libc | file://:0:0:0:0 | Crate([email protected]) |
| main.rs:224:13:224:25 | ...::realloc | file://:0:0:0:0 | fn realloc |
| main.rs:224:13:224:25 | ...::realloc | file://:0:0:0:0 | fn realloc |
Expand Down