Swift: mass-enable diff-informed queries phase 2 - getASelected{Source,Sink}Location() { none() }#19761
Merged
d10c merged 1 commit intogithub:mainfrom Jun 19, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR mass-enables diff-informed incremental mode for Swift security queries by adding a new predicate and stubbing out location selection where only one side is used.
- Added
observeDiffInformedIncrementalMode()predicate to all Swift security query config modules. - Introduced
getASelectedSourceLocation(...) { none() }overrides in queries that only select sources.
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| swift/ql/lib/codeql/swift/security/regex/RegexInjectionQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/XXEQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/WeakPasswordHashingQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/UnsafeUnpackQuery.qll | Add observeDiffInformedIncrementalMode and getASelectedSourceLocation |
| swift/ql/lib/codeql/swift/security/UnsafeJsEvalQuery.qll | Add observeDiffInformedIncrementalMode and getASelectedSourceLocation |
| swift/ql/lib/codeql/swift/security/UncontrolledFormatStringQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/StringLengthConflationQuery.qll | Add observeDiffInformedIncrementalMode and getASelectedSourceLocation |
| swift/ql/lib/codeql/swift/security/StaticInitializationVectorQuery.qll | Add observeDiffInformedIncrementalMode and getASelectedSourceLocation |
| swift/ql/lib/codeql/swift/security/SqlInjectionQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/PredicateInjectionQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/PathInjectionQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/InsufficientHashIterationsQuery.qll | Add observeDiffInformedIncrementalMode and getASelectedSourceLocation |
| swift/ql/lib/codeql/swift/security/HardcodedEncryptionKeyQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/ECBEncryptionQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/ConstantSaltQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/ConstantPasswordQuery.qll | Add observeDiffInformedIncrementalMode and getASelectedSourceLocation |
| swift/ql/lib/codeql/swift/security/CommandInjectionQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/CleartextTransmissionQuery.qll | Add observeDiffInformedIncrementalMode |
| swift/ql/lib/codeql/swift/security/CleartextLoggingQuery.qll | Add observeDiffInformedIncrementalMode |
Comments suppressed due to low confidence (3)
swift/ql/lib/codeql/swift/security/RegexInjectionQuery.qll:26
- The same
observeDiffInformedIncrementalModestub is duplicated across multiple modules; consider extracting this into a shared trait or base config to reduce repetition and simplify future updates.
predicate observeDiffInformedIncrementalMode() { any() }
swift/ql/lib/codeql/swift/security/regex/RegexInjectionQuery.qll:26
- Add dedicated tests for
observeDiffInformedIncrementalMode()to verify that diff-informed incremental flows are correctly activated and that existing queries still produce expected results.
predicate observeDiffInformedIncrementalMode() { any() }
swift/ql/lib/codeql/swift/security/UnsafeUnpackQuery.qll:30
- [nitpick] You've overridden
getASelectedSourceLocationbut notgetASelectedSinkLocation. If this query selects only sources or only sinks, ensure the complementary override is present to avoid unintended default location selection.
Location getASelectedSourceLocation(DataFlow::Node sink) { none() }
geoffw0
previously approved these changes
Jun 17, 2025
Contributor
geoffw0
left a comment
There was a problem hiding this comment.
I'm a bit confused as to why we didn't merge https://github.com/github/codeql/pull/19662/files first, but LGTM.
Contributor
Author
7e4c0c4 to
67bccc3
Compare
geoffw0
approved these changes
Jun 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacks on top of earlier PR: #19659
Uses patch from: https://github.com/github/codeql-patch/pull/88/commits/ec5681e740c18c792443099fb3e413446616a0ee
Adds
getASelected{Source,Sink}Location() { none() }override to queries that select a dataflow source or sink as a location, but not both.