Skip to content

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

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

Conversation

d10c
Copy link
Contributor

@d10c d10c commented Jun 17, 2025

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
@github-actions github-actions bot added the Java label Jun 17, 2025
@d10c d10c 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
@Copilot Copilot AI review requested due to automatic review settings June 17, 2025 14:34
@d10c d10c requested a review from a team as a code owner June 17, 2025 14:34
@d10c d10c requested a review from michaelnebel June 17, 2025 14:34
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 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
File Description
UnsafeAndroidAccessQuery.qll Added observeDiffInformedIncrementalMode() override
SensitiveUiQuery.qll Added observeDiffInformedIncrementalMode() override
InsecureBasicAuthQuery.qll Added observeDiffInformedIncrementalMode() override
HttpsUrlsQuery.qll Added observeDiffInformedIncrementalMode() override
HardcodedCredentialsSourceCallQuery.qll Added observeDiffInformedIncrementalMode() override
HardcodedCredentialsApiCallQuery.qll Added observeDiffInformedIncrementalMode() override
ArbitraryApkInstallationQuery.qll Added 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() }

@@ -15,6 +15,8 @@ module FetchUntrustedResourceConfig implements DataFlow::ConfigSig {
predicate isSink(DataFlow::Node sink) { sink instanceof UrlResourceSink }

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

predicate observeDiffInformedIncrementalMode() { any() }
Copy link
Preview

Copilot AI Jun 17, 2025

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.

@@ -17,6 +17,8 @@ module BasicAuthFlowConfig implements DataFlow::ConfigSig {
predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) {
any(HttpUrlsAdditionalTaintStep c).step(node1, node2)
}

predicate observeDiffInformedIncrementalMode() { any() }
Copy link
Preview

Copilot AI Jun 17, 2025

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
predicate observeDiffInformedIncrementalMode() { any() }
predicate observeDiffInformedIncrementalMode() { any() }

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
Java no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant