Repository navigation
Conversation
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
These tests fail until type-switch implicit variable assignments are modeled as write instructions in the next commit. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The foundational SSA/IR migration has unresolved behavior and compatibility regressions that need human validation.
3 open issues
What changed in this PR
Refactors Go’s static single-assignment (SSA) analysis to use shared CodeQL classes.
Changes:
- Migrates data-flow, control-flow, framework models, and queries to definition-based APIs.
- Adds deprecated compatibility classes and explicit type-switch write targets.
- Updates test expectations, annotation comments, and migration notes.
| File | Description |
|---|---|
| go/ql/test/query-tests/Security/CWE-601/BadRedirectCheck/BadRedirectCheck.expected | Updates parameter labels. |
| go/ql/test/query-tests/Security/CWE-347/MissingJwtSignatureCheck.expected | Updates parameter labels. |
| go/ql/test/query-tests/Security/CWE-326/InsufficientKeySize.expected | Updates labels and section ordering. |
| go/ql/test/query-tests/Security/CWE-322/InsecureHostKeyCallback.expected | Updates parameter labels. |
| go/ql/test/query-tests/Security/CWE-312/CleartextLogging.expected | Updates parameter labels. |
| go/ql/test/query-tests/Security/CWE-079/StoredXss.expected | Updates parameter labels. |
| go/ql/test/query-tests/Security/CWE-022/ZipSlip.expected | Updates parameter labels. |
| go/ql/test/query-tests/Security/CWE-022/UnsafeUnzipSymlink.expected | Updates parameter labels. |
| go/ql/test/query-tests/InconsistentCode/UnhandledCloseWritableHandle/UnhandledCloseWritableHandle.expected | Updates parameter and capture labels. |
| go/ql/test/library-tests/semmle/go/frameworks/Twirp/RequestForgery.expected | Updates parameter and capture labels. |
| go/ql/test/library-tests/semmle/go/frameworks/gqlgen/graph/schema.resolvers.go | Updates an expectation comment only. |
| go/ql/test/library-tests/semmle/go/frameworks/GoMicro/main.go | Updates an expectation comment only. |
| go/ql/test/library-tests/semmle/go/frameworks/GoMicro/LogInjection.expected | Updates request-parameter labels. |
| go/ql/test/library-tests/semmle/go/frameworks/GoKit/main.go | Updates expectation comments only. |
| go/ql/test/library-tests/semmle/go/frameworks/Beego/CleartextLogging.expected | Updates parameter labels. |
| go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaWithFields.expected | Updates definition labels. |
| go/ql/test/library-tests/semmle/go/dataflow/SSA/SsaDefinition.expected | Updates definition labels. |
| go/ql/test/library-tests/semmle/go/dataflow/SSA/DefUse.ql | Queries definition-based expression reads. |
| go/ql/test/library-tests/semmle/go/dataflow/SSA/DefUse.expected | Reflects expression-read results. |
| go/ql/test/library-tests/semmle/go/dataflow/FunctionInputsAndOutputs/FunctionInput_getExitNode.expected | Updates parameter labels. |
| go/ql/test/library-tests/semmle/go/dataflow/FlowSteps/LocalFlowStep.expected | Updates parameter and capture labels. |
| go/ql/test/library-tests/semmle/go/dataflow/ExternalValueFlow/srcs.expected | Updates source-parameter labels. |
| go/ql/test/library-tests/semmle/go/dataflow/ExternalTaintFlow/srcs.expected | Updates source-parameter labels. |
| go/ql/test/experimental/Unsafe/WrongUsageOfUnsafe.expected | Updates parameter labels. |
| go/ql/test/experimental/CWE-522-DecompressionBombs/DecompressionBombs.expected | Updates parameter labels. |
| go/ql/test/example-tests/snippets/typeinfo.expected | Updates a parameter label. |
| go/ql/src/RedundantCode/DeadStoreOfLocal.ql | Uses explicit-write definitions. |
| go/ql/src/RedundantCode/DeadStoreOfField.ql | Uses the renamed definition predicate. |
| go/ql/src/InconsistentCode/WrappedErrorAlwaysNil.ql | Uses definition-based reads. |
| go/ql/src/InconsistentCode/MissingErrorCheck.ql | Migrates phi-input lookup. |
| go/ql/src/experimental/IntegerOverflow/RangeAnalysis.qll | Migrates range analysis to shared definitions. |
| go/ql/lib/semmle/go/frameworks/stdlib/NetHttp.qll | Uses base definitions. |
| go/ql/lib/semmle/go/frameworks/RsCors.qll | Migrates configuration-definition lookup. |
| go/ql/lib/semmle/go/frameworks/Macaron.qll | Uses base definitions. |
| go/ql/lib/semmle/go/frameworks/GinCors.qll | Migrates configuration-definition lookup. |
| go/ql/lib/semmle/go/frameworks/Fasthttp.qll | Uses base definitions. |
| go/ql/lib/semmle/go/frameworks/Beego.qll | Uses base definitions. |
| go/ql/lib/semmle/go/dataflow/SsaImpl.qll | Instantiates shared SSA classes. |
| go/ql/lib/semmle/go/dataflow/SSA.qll | Exports shared classes and compatibility wrappers. |
| go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll | Accepts definitions in the SSA-node helper. |
| go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll | Migrates local flow and capture handling. |
| go/ql/lib/semmle/go/dataflow/internal/DataFlowNodes.qll | Integrates shared definitions into flow nodes. |
| go/ql/lib/semmle/go/dataflow/GlobalValueNumbering.qll | Uses shared explicit-write definitions. |
| go/ql/lib/semmle/go/controlflow/IR.qll | Models type-switch write targets. |
| go/ql/lib/semmle/go/controlflow/Guards.qll | Reuses shared SSA classes. |
| go/ql/lib/semmle/go/controlflow/ControlFlowGraph.qll | Renames the definition predicate. |
| go/ql/lib/change-notes/2026-10-20-shared-ssa.md | Documents the breaking API migration. |
Review effort: Max
Co-authored-by: Copilot <[email protected]>
Comment on lines
+143
to
147
| /** Holds if this node defines SSA definition `def` to be `rhs`. */ | ||
| predicate definesSsaDefinition(SsaDefinition def, DataFlow::Node rhs) { | ||
| super.getLhs().asSsaDefinition() = def and | ||
| super.getRhs() = rhs.asInstruction() | ||
| } |
Comment on lines
+1141
to
+1142
| /** Gets the SSA definition being written to, if any. */ | ||
| SsaDefinition asSsaDefinition() { this.getWrite() = result.(SsaExplicitWrite).getDefinition() } |
| * corresponding to `a.b`. | ||
| */ | ||
| SsaVariable getBaseVariable() { | ||
| SsaDefinition getBaseDefinition() { |
Comment on lines
+990
to
+991
| predicate readsSsaDefinition(SsaDefinition def) { | ||
| exists(SsaNode ssa | ssa.getDefinition() = def and this = ssa.getAUse()) |
This branch has not been deployed
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.

No description provided.