Skip to content

Rust: Diff-informed queries: phase 3 (non-trivial locations) #20081

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 8 commits into
base: main
Choose a base branch
from

Conversation

d10c
Copy link
Contributor

@d10c d10c commented Jul 17, 2025

This PR enables diff-informed mode on queries that select a location other than dataflow source or sink. This entails adding a non-trivial location override that returns the locations that are actually selected.

Prior work includes PRs like #19663, #19759, and #19817. This PR uses the same patch script as those PRs to find candidate queries to convert to diff-enabled. This is the final step in mass-enabling diff-informed queries on all the languages.

Commit-by-commit reviewing is recommended.

  • I have split the commits that add/modify tests from the ones that enable/disable diff-informed queries.
  • If the commit modifies a .qll file, in the commit message I've included links to the queries that depend on that .qll for easier reviewing.
  • Feel free to delegate parts of the review to others who may be more specialized in certain languages.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jul 17, 2025
@d10c d10c added the no-change-note-required This PR does not need a change note label Jul 17, 2025
@d10c d10c marked this pull request as ready for review July 17, 2025 14:46
@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 14:46
@d10c d10c requested a review from a team as a code owner July 17, 2025 14:47
@d10c d10c requested a review from michaelnebel July 17, 2025 14:47
Copy link
Contributor

@Copilot 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 enables diff-informed mode on Rust security queries that select non-trivial locations (locations other than dataflow source or sink). The change adds diff-informed query capabilities to improve incremental analysis performance by only analyzing code changes that are relevant to the query results.

  • Adds observeDiffInformedIncrementalMode() predicate to enable diff-informed mode on 8 security queries
  • Implements custom location override in AccessAfterLifetime.ql to return the actual selected locations
  • Maintains existing query logic while adding incremental analysis optimization

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
AccessInvalidPointer.ql Adds diff-informed mode enablement
AccessAfterLifetime.ql Adds diff-informed mode with custom location override for target variables
UncontrolledAllocationSize.ql Adds diff-informed mode enablement
CleartextLogging.ql Adds diff-informed mode enablement
CleartextTransmission.ql Adds diff-informed mode enablement
SqlInjection.ql Adds diff-informed mode enablement
TaintedPath.ql Adds diff-informed mode enablement
RegexInjection.ql Adds diff-informed mode enablement

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.

1 participant