Skip to content

Java: mass enable diff-informed data flow + none() overrides - #19795

Merged
d10c merged 1 commit into
github:mainfrom
d10c:d10c/java/diff-informed-2
Jun 19, 2025
Merged

Java: mass enable diff-informed data flow + none() overrides#19795
d10c merged 1 commit into
github:mainfrom
d10c:d10c/java/diff-informed-2

Conversation

@d10c

@d10cd10c commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

An auto-generated patch that enables diff-informed data flow in the obvious cases.

  • Adds observeDiffInformedIncrementalMode() { any() } override to queries that don't select a location other than a dataflow source or sink.
  • Adds getASelected{Source,Sink}Location() { none() } override to queries that select a dataflow source or sink as a location, but not both.

Java has previously had a round of diff-informed query enablements, but it seems some queries were missed in the first round.

An auto-generated patch that enables diff-informed data flow in the obvious cases.
Builds on github#18346 and github/codeql-patch#88
@d10cd10c added the no-change-note-required This PR does not need a change note label Jun 17, 2025
@d10c
d10c marked this pull request as ready for review June 17, 2025 14:34
CopilotAI review requested due to automatic review settings June 17, 2025 14:34
@d10c
d10c requested a review from a team as a code ownerJune 17, 2025 14:34
@d10c
d10c requested a review from michaelnebelJune 17, 2025 14:34

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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 auto-enables diff-informed data flow for several Java security queries by adding the required overrides in their DataFlow configurations.

  • Adds observeDiffInformedIncrementalMode() override returning any() in eight config modules.
  • Adds getASelectedSourceLocation() override returning none() in the APK installation config.
  • Covers queries that were omitted in the previous diff-informed enablement pass.

Reviewed Changes

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

Show a summary per file
FileDescription
UnsafeAndroidAccessQuery.qllAdded observeDiffInformedIncrementalMode() override
SensitiveUiQuery.qllAdded observeDiffInformedIncrementalMode() override
InsecureBasicAuthQuery.qllAdded observeDiffInformedIncrementalMode() override
HttpsUrlsQuery.qllAdded observeDiffInformedIncrementalMode() override
HardcodedCredentialsSourceCallQuery.qllAdded observeDiffInformedIncrementalMode() override
HardcodedCredentialsApiCallQuery.qllAdded observeDiffInformedIncrementalMode() override
ArbitraryApkInstallationQuery.qllAdded observeDiffInformedIncrementalMode() and getASelectedSourceLocation() overrides
TextFieldTrackingConfig in SensitiveUiQuery.qll (module excerpt)Added observeDiffInformedIncrementalMode() override
Comments suppressed due to low confidence (2)

java/ql/lib/semmle/code/java/security/ArbitraryApkInstallationQuery.qll:29

  • [nitpick] If only getASelectedSourceLocation is overridden, add a comment explaining why getASelectedSinkLocation isn’t needed, to clarify intent for future readers.
 Location getASelectedSourceLocation(DataFlow::Node sink) { none() }

java/ql/lib/semmle/code/java/security/ArbitraryApkInstallationQuery.qll:27

  • Consider adding or updating tests to verify that the query behaves correctly under diff-informed incremental mode, ensuring no regressions are introduced.
 predicate observeDiffInformedIncrementalMode() { any() }


predicate isBarrier(DataFlow::Node sanitizer) { sanitizer instanceof RequestForgerySanitizer }

predicate observeDiffInformedIncrementalMode() { any() }

CopilotAIJun 17, 2025

Copy link

Choose a reason for hiding this comment

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

This observeDiffInformedIncrementalMode() override is duplicated across many config modules. Consider providing a default implementation in DataFlow::ConfigSig to reduce boilerplate.

Copilot uses AI. Check for mistakes.
any(HttpUrlsAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }

CopilotAIJun 17, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] For consistency with surrounding modules, ensure there’s a blank line after this predicate and before the closing brace, matching the established file style.

Suggested change
predicateobserveDiffInformedIncrementalMode(){any()}
predicateobserveDiffInformedIncrementalMode(){any()}

Copilot uses AI. Check for mistakes.

@michaelnebelmichaelnebel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@d10c
d10c merged commit f577c08 into github:mainJun 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Javano-change-note-requiredThis PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@d10c@michaelnebel