Repository navigation
Conversation
Comment on lines
+1
to
+3
| /** | ||
| * Provides data-flow modelling of constructor patterns / enum-case constructors. | ||
| */ |
asgerf
force-pushed
the
unified/more-data-flow
branch
3 times, most recently
from
October 8, 2026 09:13
1c464b7 to
65f475f
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Enum content identity, optional try? flattening, and guard-pattern flow have unresolved correctness issues.
5 open findings
What changed in this PR
Adds unified Swift data flow for enum associated values, operators, array literals, and for-in loops.
Changes:
- Models enum constructor storage and pattern extraction.
- Propagates flow through Swift casts, error-handling, async, and array operations.
- Extends path-injection models and regression coverage.
| File | Description |
|---|---|
unified/ql/test/query-tests/security/CWE-022/PathInjection/testPathInjection.swift |
Updates cast-flow alert annotations. |
unified/ql/test/query-tests/security/CWE-022/PathInjection/PathInjectionTest.expected |
Regenerates path-injection results. |
unified/ql/test/library-tests/dataflow/test.swift |
Adds operator and array-flow tests. |
unified/ql/test/library-tests/dataflow/test.expected |
Regenerates data-flow expectations. |
unified/ql/test/library-tests/dataflow/enums.swift |
Adds enum associated-value tests. |
unified/ql/test/library-tests/dataflow/CONSISTENCY/CfgConsistency.expected |
Records CFG consistency output. |
unified/ql/test/library-tests/controlflow/CONSISTENCY/DataFlowConsistency.expected |
Updates consistency expectations. |
unified/ql/src/queries/security/CWE-022/PathInjection.ql |
Adds flow through path properties. |
unified/ql/lib/ext/legacy-swift.model.yml |
Models one-argument Data(contentsOf:). |
unified/ql/lib/codeql/unified/internal/dataflow/Step.qll |
Adds array-content step helpers. |
unified/ql/lib/codeql/unified/internal/dataflow/DataFlowPluginSwift.qll |
Models Swift operators and casts. |
unified/ql/lib/codeql/unified/internal/dataflow/DataFlowInstantiation.qll |
Hides expression-pattern value nodes. |
unified/ql/lib/codeql/unified/internal/dataflow/DataFlowGraph.qll |
Adds enum, pattern, and array edges. |
unified/ql/lib/codeql/unified/internal/dataflow/Content.qll |
Defines array and enum content keys. |
unified/ql/lib/codeql/unified/internal/dataflow/ConstructorPatterns.qll |
Resolves enum constructor patterns. |
unified/ql/lib/codeql/unified/internal/dataflow/AllDataFlow.qll |
Imports constructor-pattern support. |
unified/ql/consistency-queries/DataFlowConsistency.ql |
Excludes plugin reads from reverse-read checks. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Comment on lines
+49
to
+53
| predicate isAdditionalFlowStep(DataFlow::Node node1, DataFlow::Node node2) { | ||
| exists(MemberAccessExpr expr | | ||
| expr.getMemberName() = "path" and | ||
| node1.isResultValue(expr.getBase()) and | ||
| node2.isResultValue(expr) |
Contributor
Author
There was a problem hiding this comment.
I'm OK with this for now
asgerf
marked this pull request as ready for review
October 8, 2026 12:38
Only array literals and for-in statements are handled
Note that one of the annotations were moved because the location we report is different
The data-flow consistency errors are easier to fix once the stage-splitting of TDataFlowNode has merged, which is part of another PR (variable-capture).
Without the 'case' keyword the pattern is implicitly wrapped in .some, which was not the intention here
asgerf
force-pushed
the
unified/more-data-flow
branch
from
October 8, 2026 14:33
60bdcac to
b8a4f66
Compare
The file now passes 'swiftc -typecheck' without errors
This change happened after rebasing onto the SSA changes, which had significant impact for unified data flow
asgerf
force-pushed
the
unified/more-data-flow
branch
from
October 8, 2026 15:10
b8a4f66 to
9211707
Compare
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.



try,try?,try!,as,as?,as!, andawaitoperators.for..inloops.