Conversation
Replace the legacy Actions CFG implementation with the shared CFG pipeline, keep data-flow nodes canonical, and ensure callable roots are connected without scalar-expression cycles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The foundational CFG and data-flow migration has broad compatibility implications that warrant final human validation.
Review effort: Balanced
Findings: None
What changed in this PR
Migrates GitHub Actions control-flow analysis to the shared CFG framework while retaining compatibility APIs.
Changes:
- Rebuilds CFG scopes, nodes, basic blocks, and data-flow integration on shared infrastructure.
- Corrects environment-expression ownership and adds consistency/regression checks.
- Documents intentional API and raw-CFG compatibility changes.
| File | Description |
|---|---|
actions/ql/lib/codeql/actions/controlflow/internal/Cfg.qll |
Implements the shared CFG integration. |
actions/ql/lib/codeql/actions/controlflow/BasicBlocks.qll |
Adapts existing basic-block APIs. |
actions/ql/lib/codeql/actions/Cfg.qll |
Re-exports the new implementation. |
actions/ql/lib/codeql/actions/dataflow/internal/DataFlowPrivate.qll |
Selects unique injected CFG nodes for data flow. |
actions/ql/lib/change-notes/2026-09-29-shared-cfg.md |
Documents breaking changes. |
actions/ql/consistency-queries/qlpack.yml |
Defines the Actions consistency pack. |
actions/ql/consistency-queries/CfgConsistency.ql |
Enables shared CFG checks. |
actions/ql/test/library-tests/cfg-environment/test.ql |
Tests environment CFG integrity. |
actions/ql/test/library-tests/cfg-environment/test.expected |
Records environment test results. |
actions/ql/test/library-tests/cfg-environment/.github/workflows/test.yml |
Supplies environment ownership cases. |
actions/ql/test/library-tests/basic/test.ql |
Extends CFG API regression coverage. |
actions/ql/test/library-tests/basic/test.expected |
Updates shared-CFG expectations. |
actions/ql/test/query-tests/Security/CWE-078/CONSISTENCY/CfgConsistency.expected |
Records empty consistency findings. |
actions/ql/test/query-tests/Security/CWE-088/CONSISTENCY/CfgConsistency.expected |
Records empty consistency findings. |
actions/ql/test/query-tests/Security/CWE-094/CONSISTENCY/CfgConsistency.expected |
Records empty consistency findings. |
actions/ql/test/query-tests/Security/CWE-829/CONSISTENCY/CfgConsistency.expected |
Records empty consistency findings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Restore Actions-specific basic-block, scope, node, and traversal APIs on top of the shared CFG implementation, and document the intentional completion API removal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Attach environment expressions once to their declaring workflow, job, or step so shared CFG nodes do not acquire multiple parents or form cycles. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
owen-mc
force-pushed
the
actions/migrate-shared-cfg
branch
from
September 29, 2026 16:20
2e616bb to
c5f521d
Compare
| class BooleanCompletion extends NormalCompletion, TBooleanCompletion { | ||
| boolean value; | ||
| Callable getEnclosingCallable(AstNode node) { | ||
| result = node.(Callable) |
aschackmull
reviewed
Oct 2, 2026
| Callable getEnclosingCallable(AstNode node) { | ||
| result = node.(Callable) | ||
| or | ||
| result = getEnclosingCallable(node.getParentNode()) |
Contributor
There was a problem hiding this comment.
I don't know about actions, but in most languages this is wrong. If a callable is nested inside another callable then the innermost nodes get 2 enclosing callables.
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.
Migrates the GitHub Actions control-flow graph to the shared CFG construction library already used by Java, C#, Ruby and Go.
Meaningful CFG changes
Ignoring the synthetic before/after and entry/exit nodes introduced by the shared library, there are two intentional topology changes relative to the old CFG:
Environment expressions are evaluated at their declaration site.
Run,UsesStep, or reusable-workflow job that could consume it. An inherited workflow- or job-level expression could therefore appear under many consumers, giving the same AST node multiple structural parents and successors.envmapping declares it. Consumers no longer become structural CFG parents of inherited expressions.Expressions embedded in run scripts have a single structural path.
Runand a child of the scriptScalarValue, creating duplicate paths to the same AST expression.ScalarValueis now a CFG leaf. Script expressions remain direct children of theRun, so no expression is lost; only the redundant parent/edge is removed.Compatibility
The shared implementation introduces explicit before/after and entry/exit nodes, so code relying on exact raw CFG nodes, edges, textual representations, or basic-block boundaries may need updating.
The obsolete
Completion,NormalCompletion,SimpleCompletion,BooleanCompletion, andReturnCompletionclasses are intentionally removed. Callers should inspect successor edge types such asDirectSuccessor,BooleanSuccessor, andReturnSuccessorinstead. Other established Actions CFG APIs are retained on top of the shared implementation.Commit structure
The history is organized into three independently testable commits: