-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rust: Remove references to getResolvedPath and getExtendedCanonicalPath
#20224
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
Rust: Remove references to getResolvedPath and getExtendedCanonicalPath
#20224
Conversation
88e92c7 to
51fb215
Compare
| // r.getResolvedCrateOrigin() = i.getCrateOrigin() | ||
| // or | ||
| // not r.hasResolvedCrateOrigin() and not i.hasCrateOrigin() | ||
| // ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is RustAnalyzerComparison.qll? Is there a reason for leaving these predicates in (as none()) for the time being?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was used to compare data in DCA, but those reports have now been disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great.
geoffw0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I notice the PR is a draft - are we waiting for anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes references to deprecated getResolvedPath and getExtendedCanonicalPath methods from the Rust CodeQL library and test files. The changes replace these methods with alternative approaches using getCanonicalPath() or disable functionality by returning none() where appropriate.
Key changes:
- Replace
getResolvedPath()calls withgetCanonicalPath()or simpler path resolution methods - Comment out or remove code that depended on
getExtendedCanonicalPath() - Update test expectations to reflect the removal of deprecated functionality
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/ql/test/library-tests/sensitivedata/SensitiveData.ql | Replace getResolvedPath() with simplified path segment text matching |
| rust/ql/test/library-tests/dataflow/sources/InlineFlow.ql | Replace getResolvedPath() with simplified path segment text matching |
| rust/ql/test/extractor-tests/canonical_path_disabled/canonical_paths.expected | Remove expected test output for deprecated path resolution queries |
| rust/ql/test/extractor-tests/canonical_path/canonical_paths.ql | Remove queries that used deprecated getExtendedCanonicalPath() and getResolvedPath() |
| rust/ql/test/extractor-tests/canonical_path/canonical_paths.expected | Remove expected test output for deprecated path resolution queries |
| rust/ql/src/queries/telemetry/RustAnalyzerComparison.qll | Comment out code using deprecated methods and return none() to disable functionality |
| rust/ql/lib/codeql/rust/frameworks/stdlib/Stdlib.qll | Replace getResolvedPath() with getCanonicalPath() via static target |
| rust/ql/lib/codeql/rust/dataflow/internal/FlowSummaryImpl.qll | Remove method that used deprecated getResolvedPath() |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| .getArgList() | ||
| .getAnArg() = sink.asExpr().getExpr() | ||
| any(CallExpr call | | ||
| call.getFunction().(PathExpr).getPath().getSegment().getIdentifier().getText() = "sink" |
Copilot
AI
Aug 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new path resolution approach is fragile as it only checks the final segment identifier. This will match any function named 'sink' regardless of module/crate. Consider using a more specific matching approach or add additional checks to ensure the correct function is matched.
| call.getFunction().(PathExpr).getPath().getSegment().getIdentifier().getText() = "sink" | |
| call.getFunction().(PathExpr).getPath().toString() = "sink" |
| .getArgList() | ||
| .getAnArg() = sink.asExpr().getExpr() | ||
| any(CallExpr call | | ||
| call.getFunction().(PathExpr).getPath().getSegment().getIdentifier().getText() = "sink" |
Copilot
AI
Aug 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new path resolution approach is fragile as it only checks the final segment identifier. This will match any function named 'sink' regardless of module/crate. The original code used pattern matching with '%::sink' which was more specific. Consider using a more robust matching approach.
| call.getFunction().(PathExpr).getPath().getSegment().getIdentifier().getText() = "sink" | |
| call.getFunction().(PathExpr).getPath().toString().matches("%::sink") |
No description provided.