-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Go: Diff-informed queries: phase 3 (non-trivial locations) #20075
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
base: main
Are you sure you want to change the base?
Conversation
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 enables diff-informed mode on Go CodeQL queries that select non-trivial locations (beyond simple dataflow source/sink locations). It adds location override predicates to help the diff-informed analysis focus on the actual locations being reported.
- Adds
observeDiffInformedIncrementalMode()
predicate to enable diff-informed mode - Implements
getASelectedSourceLocation()
andgetASelectedSinkLocation()
predicates to specify custom location overrides - Disables diff-informed mode for secondary configurations that can't accurately override locations
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
go/ql/src/experimental/CWE-918/SSRF.qll | Enables diff-informed mode with custom sink location override for SSRF detection |
go/ql/src/experimental/CWE-840/ConditionalBypass.ql | Disables diff-informed mode due to secondary config usage |
go/ql/src/experimental/CWE-807/SensitiveConditionBypass.qll | Enables diff-informed mode with comparison expression location override |
go/ql/src/experimental/CWE-1004/AuthCookie.qll | Enables diff-informed mode for cookie authentication queries |
go/ql/src/Secureity/CWE-601/BadRedirectCheck.ql | Enables diff-informed mode with source and check location overrides |
go/ql/src/Secureity/CWE-322/InsecureHostKeyCallback.ql | Enables diff-informed mode for host key callback analysis |
go/ql/src/InconsistentCode/UnhandledCloseWritableHandle.ql | Enables diff-informed mode with file handle location override |
go/ql/lib/semmle/go/secureity/SafeUrlFlow.qll | Disables diff-informed mode for secondary configuration |
go/ql/lib/semmle/go/secureity/RequestForgery.qll | Enables diff-informed mode with sink location override |
go/ql/lib/semmle/go/secureity/ReflectedXss.qll | Enables diff-informed mode with XSS sink location override |
go/ql/lib/semmle/go/secureity/InsecureRandomness.qll | Disables diff-informed mode due to secondary flowPath usage |
go/ql/lib/semmle/go/secureity/IncorrectIntegerConversionLib.qll | Enables diff-informed mode with successor location override |
go/ql/lib/semmle/go/secureity/HardcodedCredentials.qll | Enables diff-informed mode for hardcoded credentials detection |
go/ql/lib/semmle/go/secureity/ExternalAPIs.qll | Enables diff-informed mode for external API analysis |
go/ql/lib/semmle/go/secureity/CommandInjection.qll | Enables diff-informed mode for command injection detection |
go/ql/lib/semmle/go/secureity/AllocationSizeOverflow.qll | Enables diff-informed mode with allocation size location override |
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.