Skip to content

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

d10c
Copy link
Contributor

@d10c d10c commented Jul 17, 2025

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.

d10c added 15 commits July 17, 2025 11:46
@github-actions github-actions bot added the Go label Jul 17, 2025
@d10c d10c added the no-change-note-required This PR does not need a change note label Jul 17, 2025
@d10c d10c marked this pull request as ready for review July 17, 2025 13:55
@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 13:55
@d10c d10c requested a review from a team as a code owner July 17, 2025 13:55
@d10c d10c requested a review from michaelnebel July 17, 2025 13:55
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 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() and getASelectedSinkLocation() 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/Security/CWE-601/BadRedirectCheck.ql Enables diff-informed mode with source and check location overrides
go/ql/src/Security/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/security/SafeUrlFlow.qll Disables diff-informed mode for secondary configuration
go/ql/lib/semmle/go/security/RequestForgery.qll Enables diff-informed mode with sink location override
go/ql/lib/semmle/go/security/ReflectedXss.qll Enables diff-informed mode with XSS sink location override
go/ql/lib/semmle/go/security/InsecureRandomness.qll Disables diff-informed mode due to secondary flowPath usage
go/ql/lib/semmle/go/security/IncorrectIntegerConversionLib.qll Enables diff-informed mode with successor location override
go/ql/lib/semmle/go/security/HardcodedCredentials.qll Enables diff-informed mode for hardcoded credentials detection
go/ql/lib/semmle/go/security/ExternalAPIs.qll Enables diff-informed mode for external API analysis
go/ql/lib/semmle/go/security/CommandInjection.qll Enables diff-informed mode for command injection detection
go/ql/lib/semmle/go/security/AllocationSizeOverflow.qll Enables diff-informed mode with allocation size location override

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.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy