Skip to content

Conversation

@d10c
Copy link
Contributor

@d10c d10c commented Jun 13, 2025

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.

@github-actions github-actions bot added the Go label Jun 13, 2025
@d10c d10c marked this pull request as ready for review June 17, 2025 08:39
Copilot AI review requested due to automatic review settings June 17, 2025 08:39
@d10c d10c requested a review from a team as a code owner June 17, 2025 08:39
@d10c d10c added the no-change-note-required This PR does not need a change note label Jun 17, 2025
Copy link
Contributor

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 mass-enables diff-informed queries in Go CodeQL packs by adding a no-op observeDiffInformedIncrementalMode predicate and default getASelected{Source,Sink}Location() overrides where only one side is selected.

  • Introduces predicate observeDiffInformedIncrementalMode() { any() } in numerous Config modules.
  • Adds getASelectedSourceLocation(...) { none() } and/or getASelectedSinkLocation(...) { none() } overrides in cases where only one of source or sink is selected.
  • Builds on phase 1 to ensure diff-informed incremental mode compatibility.

Reviewed Changes

Copilot reviewed 32 out of 31 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
go/ql/src/experimental/frameworks/DecompressionBombs.qll Added observeDiffInformedIncrementalMode predicate
go/ql/src/experimental/CWE-74/DsnInjectionCustomizations.qll Added observeDiffInformedIncrementalMode predicate
go/ql/src/experimental/CWE-369/DivideByZero.ql Added observeDiffInformedIncrementalMode predicate and getASelectedSourceLocation override
go/ql/src/experimental/CWE-327/WeakCryptoAlgorithmCustomizations.qll Added observeDiffInformedIncrementalMode predicate
go/ql/src/experimental/CWE-321-V2/HardCodedKeys.ql Added observeDiffInformedIncrementalMode predicate
go/ql/src/experimental/CWE-287/ImproperLdapAuthCustomizations.qll Added observeDiffInformedIncrementalMode predicate
go/ql/src/experimental/CWE-285/PamAuthBypass.ql Added observeDiffInformedIncrementalMode predicate and getASelectedSinkLocation override
go/ql/src/experimental/CWE-203/Timing.ql Added observeDiffInformedIncrementalMode predicate
go/ql/src/experimental/CWE-090/LDAPInjection.qll Added observeDiffInformedIncrementalMode predicate
go/ql/src/Security/CWE-640/EmailInjection.qll Added observeDiffInformedIncrementalMode predicate
go/ql/src/Security/CWE-352/ConstantOauth2State.ql Added observeDiffInformedIncrementalMode predicate
go/ql/src/Security/CWE-326/InsufficientKeySize.ql Added observeDiffInformedIncrementalMode predicate and getASelectedSourceLocation override
go/ql/src/Security/CWE-209/StackTraceExposure.ql Added observeDiffInformedIncrementalMode predicate
go/ql/src/Security/CWE-079/HtmlTemplateEscapingBypassXss.ql Added observeDiffInformedIncrementalMode predicate
go/ql/src/Security/CWE-020/SuspiciousCharacterInRegexp.ql Added observeDiffInformedIncrementalMode predicate
go/ql/src/Security/CWE-020/MissingRegexpAnchor.ql Added observeDiffInformedIncrementalMode predicate and getASelectedSinkLocation override
go/ql/src/Security/CWE-020/IncompleteHostnameRegexp.ql Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/ZipSlip.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/XPathInjection.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/UnsafeUnzipSymlink.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/UncontrolledAllocationSize.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/TaintedPath.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/StringBreak.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/StoredXss.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/StoredCommand.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/SqlInjection.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/OpenUrlRedirect.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/MissingJwtSignatureCheck.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/LogInjection.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/ExternalAPIs.qll Added observeDiffInformedIncrementalMode predicate
go/ql/lib/semmle/go/security/CleartextLogging.qll Added observeDiffInformedIncrementalMode predicate
Comments suppressed due to low confidence (2)

go/ql/src/experimental/CWE-369/DivideByZero.ql:51

  • No tests currently cover the new getASelectedSourceLocation override; consider adding test cases to validate that diff-informed incremental mode correctly handles source-only location configurations.
Location getASelectedSourceLocation(DataFlow::Node sink) { none() }

go/ql/src/experimental/frameworks/DecompressionBombs.qll:60

  • [nitpick] Add a brief comment above observeDiffInformedIncrementalMode explaining its purpose and how it interacts with diff-informed incremental runs, so future maintainers understand why this no-op override is needed.
predicate observeDiffInformedIncrementalMode() { any() }

)
}

predicate observeDiffInformedIncrementalMode() { any() }
Copy link

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.

The observeDiffInformedIncrementalMode predicate is duplicated across many configs; consider extracting it into a shared mixin or base module to reduce boilerplate and improve maintainability.

Copilot uses AI. Check for mistakes.
@d10c d10c requested a review from michaelnebel June 17, 2025 12:53
@d10c d10c force-pushed the d10c/go/diff-informed-2 branch from 1d3f49a to 51826c7 Compare June 17, 2025 15:02
Copy link
Contributor

@michaelnebel michaelnebel left a comment

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 b62a6db into github:main Jun 19, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Go 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.

2 participants