mirror of
https://github.com/github/codeql.git
synced 2026-06-03 04:40:14 +02:00
Flips the Python dataflow trunk from the legacy CFG (semmle/python/Flow.qll) and legacy ESSA SSA (semmle/python/essa/*) to the new shared CFG facade (semmle.python.controlflow.internal.Cfg) and the new SSA adapter (semmle.python.dataflow.new.internal.SsaImpl), both introduced additively in the preceding PRs in this stack. This is the trunk-flip equivalent of the original draft PR #21894 (kept around as documentation), rebased on top of the four preparatory PRs: P1: Remove AstNode.getAFlowNode() and rewrite callers (#21919). P2: Qualify Flow.qll's AST references with Py:: prefix (#21920). P3: Add new shared-CFG-backed control flow graph (#21921). P4: Add new shared-SSA-backed SSA adapter (#21923). The Python dataflow library (semmle/python/dataflow/new/) now imports the new CFG facade and SSA adapter. All CFG-typed predicates (ControlFlowNode, CallNode, BasicBlock, NameNode, AttrNode, ...) are qualified with the Cfg:: prefix; SSA references switch from EssaVariable/EssaDefinition to SsaImpl::Definition/SourceVariable. GuardNode is redesigned to use the new CFG's outcome-node model (isAfterTrue / isAfterFalse) instead of the legacy ConditionBlock + flipped indirection. Only BarrierGuard<...> is preserved as public API. Framework files (Bottle, FastApi, Django, Tornado, Pyramid, Stdlib, ...) are updated to take CFG nodes from the new facade. A handful of dataflow consistency tweaks for the new CFG: - Augmented-assignment targets are treated as both load and store. - 'from X import *' produces uncertain SSA writes for unknown names. - CFG nodes are canonicalised so dataflow does not see equivalent pre/post-order pairs as distinct nodes. Two AST tweaks for the new CFG: - AstNodeImpl: omit PEP 695 type-parameter names from FunctionDefExpr / ClassDefExpr children. - ImportResolution: drop the legacy essa import. Test churn (~175 files): reblessed library- and query-test .expected files reflect slightly different CFG granularity, different toString output, and a handful of true alert deltas in security queries. Verification: all 367 lib + src + consistency-queries compile clean. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
29 lines
1.7 KiB
Plaintext
29 lines
1.7 KiB
Plaintext
| module.py:1:13:1:18 | SOURCE | test.py:89:10:89:10 | t |
|
|
| module.py:1:13:1:18 | SOURCE | test.py:106:10:106:14 | After Attribute |
|
|
| module.py:1:13:1:18 | SOURCE | test.py:111:10:111:12 | After Attribute |
|
|
| module.py:1:13:1:18 | SOURCE | test.py:156:6:156:11 | unsafe |
|
|
| module.py:6:12:6:17 | SOURCE | test.py:101:10:101:10 | t |
|
|
| test.py:3:10:3:15 | SOURCE | test.py:3:10:3:15 | SOURCE |
|
|
| test.py:6:9:6:14 | SOURCE | test.py:7:10:7:10 | s |
|
|
| test.py:10:12:10:17 | SOURCE | test.py:13:10:13:12 | arg |
|
|
| test.py:10:12:10:17 | SOURCE | test.py:17:10:17:10 | t |
|
|
| test.py:20:9:20:14 | SOURCE | test.py:13:10:13:12 | arg |
|
|
| test.py:31:13:31:18 | SOURCE | test.py:33:16:33:16 | t |
|
|
| test.py:37:13:37:18 | SOURCE | test.py:41:14:41:14 | t |
|
|
| test.py:62:13:62:18 | SOURCE | test.py:13:10:13:12 | arg |
|
|
| test.py:67:13:67:18 | SOURCE | test.py:13:10:13:12 | arg |
|
|
| test.py:76:9:76:14 | SOURCE | test.py:78:10:78:10 | t |
|
|
| test.py:128:13:128:18 | SOURCE | test.py:132:14:132:14 | t |
|
|
| test.py:138:13:138:18 | SOURCE | test.py:142:16:142:16 | t |
|
|
| test.py:159:10:159:15 | SOURCE | test.py:160:14:160:14 | t |
|
|
| test.py:163:9:163:14 | SOURCE | test.py:165:12:165:12 | s |
|
|
| test.py:178:9:178:14 | SOURCE | test.py:180:14:180:14 | t |
|
|
| test.py:178:9:178:14 | SOURCE | test.py:182:16:182:16 | t |
|
|
| test.py:178:9:178:14 | SOURCE | test.py:184:16:184:16 | t |
|
|
| test.py:178:9:178:14 | SOURCE | test.py:186:14:186:14 | t |
|
|
| test.py:195:9:195:14 | SOURCE | test.py:197:14:197:14 | t |
|
|
| test.py:195:9:195:14 | SOURCE | test.py:199:14:199:14 | t |
|
|
| test.py:202:10:202:15 | SOURCE | test.py:204:14:204:14 | i |
|
|
| test.py:202:10:202:15 | SOURCE | test.py:205:10:205:10 | i |
|
|
| test.py:208:12:208:17 | SOURCE | test.py:214:14:214:14 | x |
|