Repository navigation
Go: (Refactor) Use makeSsa for SSA classes - #22857
Merged
Merged
Conversation
owen-mc
force-pushed
the
go/make-ssa
branch
2 times, most recently
from
October 21, 2026 13:23
024f618 to
7d8b19e
Compare
owen-mc
marked this pull request as ready for review
October 21, 2026 13:25
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 <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Implicit-read tests can miss links to the wrong SSA definition, while documentation conflates first uses with all reads and still references a removed API.
7 open issues
Assert implicit reads are paired with the correct definitions · New Preserve deprecated readsSsaVariable compatibility predicate Preserve deprecated SsaWithFields.getBaseVariable accessor Preserve deprecated WriteTarget.asSsaVariable wrapper Preserve deprecated Write.definesSsaVariable compatibility predicate Update Go guide to use the current SSA APIs · New Clarify SSA reads versus first-use semantics · New
Review effort: Max
aschackmull
approved these changes
Nov 13, 2026
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.


Instantiate
MakeSsato use more logic from the shared library.DCA doesn't show any changes.