Skip to content

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Aug 14, 2025

No description provided.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Aug 14, 2025
@hvitved hvitved force-pushed the rust/remove-extractor-resolution-references branch from 88e92c7 to 51fb215 Compare August 14, 2025 09:31
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Aug 14, 2025
// r.getResolvedCrateOrigin() = i.getCrateOrigin()
// or
// not r.hasResolvedCrateOrigin() and not i.hasCrateOrigin()
// )
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great.

Copy link
Contributor

@geoffw0 geoffw0 left a 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?

@hvitved hvitved marked this pull request as ready for review August 14, 2025 12:45
@hvitved hvitved requested a review from a team as a code owner August 14, 2025 12:45
Copilot AI review requested due to automatic review settings August 14, 2025 12:45
@hvitved hvitved merged commit 5c0300c into github:main Aug 14, 2025
21 checks passed
@hvitved hvitved deleted the rust/remove-extractor-resolution-references branch August 14, 2025 12:45
Copy link
Contributor

Copilot AI left a 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 with getCanonicalPath() 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"
Copy link

Copilot AI Aug 14, 2025

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.

Suggested change
call.getFunction().(PathExpr).getPath().getSegment().getIdentifier().getText() = "sink"
call.getFunction().(PathExpr).getPath().toString() = "sink"

Copilot uses AI. Check for mistakes.
.getArgList()
.getAnArg() = sink.asExpr().getExpr()
any(CallExpr call |
call.getFunction().(PathExpr).getPath().getSegment().getIdentifier().getText() = "sink"
Copy link

Copilot AI Aug 14, 2025

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.

Suggested change
call.getFunction().(PathExpr).getPath().getSegment().getIdentifier().getText() = "sink"
call.getFunction().(PathExpr).getPath().toString().matches("%::sink")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants