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>
124 lines
6.2 KiB
Plaintext
124 lines
6.2 KiB
Plaintext
taintFlow
|
|
| test.py:3:5:3:15 | After getSource() | test.py:4:8:4:8 | x |
|
|
| test.py:3:5:3:15 | After getSource() | test.py:7:17:7:17 | x |
|
|
| test.py:9:8:9:14 | After alias() | test.py:9:8:9:14 | After alias() |
|
|
| test.py:10:8:10:22 | After Attribute() | test.py:10:8:10:22 | After Attribute() |
|
|
| test.py:11:8:11:30 | After Attribute() | test.py:11:8:11:30 | After Attribute() |
|
|
| test.py:71:28:71:38 | After getSource() | test.py:71:8:71:39 | After Attribute() |
|
|
| test.py:75:5:75:15 | After getSource() | test.py:76:22:76:22 | x |
|
|
| test.py:75:5:75:15 | After getSource() | test.py:77:22:77:22 | y |
|
|
| test.py:81:36:81:46 | After getSource() | test.py:81:8:81:47 | After Attribute() |
|
|
| test.py:83:50:83:60 | After getSource() | test.py:83:8:83:61 | After Attribute() |
|
|
| test.py:86:49:86:59 | After getSource() | test.py:86:8:86:60 | After Attribute() |
|
|
| test.py:87:56:87:66 | After getSource() | test.py:87:8:87:67 | After Attribute() |
|
|
| test.py:114:19:114:29 | After getSource() | test.py:114:19:114:29 | After getSource() |
|
|
| test.py:115:20:115:30 | After getSource() | test.py:115:20:115:30 | After getSource() |
|
|
| test.py:116:31:116:41 | After getSource() | test.py:116:31:116:41 | After getSource() |
|
|
| test.py:117:31:117:41 | After getSource() | test.py:117:31:117:41 | After getSource() |
|
|
| test.py:118:35:118:45 | After getSource() | test.py:118:35:118:45 | After getSource() |
|
|
isSink
|
|
| test.py:4:8:4:8 | x | test-sink |
|
|
| test.py:7:17:7:17 | x | test-sink |
|
|
| test.py:9:8:9:14 | After alias() | test-sink |
|
|
| test.py:10:8:10:22 | After Attribute() | test-sink |
|
|
| test.py:11:8:11:30 | After Attribute() | test-sink |
|
|
| test.py:12:8:12:34 | After Attribute() | test-sink |
|
|
| test.py:16:11:16:13 | one | test-sink |
|
|
| test.py:17:19:17:21 | two | test-sink |
|
|
| test.py:17:24:17:28 | three | test-sink |
|
|
| test.py:17:31:17:34 | four | test-sink |
|
|
| test.py:18:37:18:40 | five | test-sink |
|
|
| test.py:19:21:19:26 | second | test-sink |
|
|
| test.py:30:21:30:23 | one | test-sink |
|
|
| test.py:32:22:32:24 | one | test-sink |
|
|
| test.py:32:27:32:29 | two | test-sink |
|
|
| test.py:33:22:33:24 | one | test-sink |
|
|
| test.py:33:27:33:29 | two | test-sink |
|
|
| test.py:33:32:33:36 | three | test-sink |
|
|
| test.py:57:27:57:33 | arg_pos | test-sink |
|
|
| test.py:66:17:66:20 | arg1 | test-sink |
|
|
| test.py:66:23:66:26 | arg2 | test-sink |
|
|
| test.py:66:34:66:43 | namedThing | test-sink |
|
|
| test.py:67:34:67:44 | secondNamed | test-sink |
|
|
| test.py:71:8:71:39 | After Attribute() | test-sink |
|
|
| test.py:72:8:72:47 | After Attribute() | test-sink |
|
|
| test.py:76:22:76:22 | x | test-sink |
|
|
| test.py:77:22:77:22 | y | test-sink |
|
|
| test.py:78:22:78:22 | z | test-sink |
|
|
| test.py:81:8:81:47 | After Attribute() | test-sink |
|
|
| test.py:82:8:82:54 | After Attribute() | test-sink |
|
|
| test.py:83:8:83:61 | After Attribute() | test-sink |
|
|
| test.py:85:8:85:53 | After Attribute() | test-sink |
|
|
| test.py:86:8:86:60 | After Attribute() | test-sink |
|
|
| test.py:87:8:87:67 | After Attribute() | test-sink |
|
|
| test.py:89:21:89:23 | one | test-sink |
|
|
| test.py:91:21:91:23 | one | test-sink |
|
|
| test.py:91:30:91:32 | two | test-sink |
|
|
| test.py:98:6:98:9 | baz2 | test-sink |
|
|
| test.py:114:19:114:29 | After getSource() | test-sink |
|
|
| test.py:115:20:115:30 | After getSource() | test-sink |
|
|
| test.py:116:31:116:41 | After getSource() | test-sink |
|
|
| test.py:117:31:117:41 | After getSource() | test-sink |
|
|
| test.py:118:35:118:45 | After getSource() | test-sink |
|
|
isSource
|
|
| test.py:3:5:3:15 | After getSource() | test-source |
|
|
| test.py:9:8:9:14 | After alias() | test-source |
|
|
| test.py:10:8:10:14 | After alias() | test-source |
|
|
| test.py:10:8:10:22 | After Attribute() | test-source |
|
|
| test.py:11:8:11:14 | After alias() | test-source |
|
|
| test.py:11:8:11:22 | After Attribute() | test-source |
|
|
| test.py:11:8:11:30 | After Attribute() | test-source |
|
|
| test.py:12:8:12:14 | After alias() | test-source |
|
|
| test.py:12:8:12:22 | After Attribute() | test-source |
|
|
| test.py:23:24:23:26 | one | test-source |
|
|
| test.py:24:33:24:35 | two | test-source |
|
|
| test.py:24:38:24:42 | three | test-source |
|
|
| test.py:24:45:24:48 | four | test-source |
|
|
| test.py:25:34:25:39 | second | test-source |
|
|
| test.py:39:11:39:20 | After Await | test-source |
|
|
| test.py:41:8:41:27 | After Attribute() | test-source |
|
|
| test.py:46:7:46:16 | After SubClass() | test-source |
|
|
| test.py:51:8:51:18 | After Sub2Class() | test-source |
|
|
| test.py:53:7:53:16 | After Attribute() | test-source |
|
|
| test.py:60:13:60:16 | self | test-source |
|
|
| test.py:60:24:60:28 | named | test-source |
|
|
| test.py:63:36:63:39 | arg2 | test-source |
|
|
| test.py:63:42:63:45 | arg3 | test-source |
|
|
| test.py:63:48:63:51 | arg4 | test-source |
|
|
| test.py:63:54:63:57 | arg5 | test-source |
|
|
| test.py:71:28:71:38 | After getSource() | test-source |
|
|
| test.py:72:36:72:46 | After getSource() | test-source |
|
|
| test.py:75:5:75:15 | After getSource() | test-source |
|
|
| test.py:81:36:81:46 | After getSource() | test-source |
|
|
| test.py:82:43:82:53 | After getSource() | test-source |
|
|
| test.py:83:50:83:60 | After getSource() | test-source |
|
|
| test.py:85:42:85:52 | After getSource() | test-source |
|
|
| test.py:86:49:86:59 | After getSource() | test-source |
|
|
| test.py:87:56:87:66 | After getSource() | test-source |
|
|
| test.py:101:29:101:31 | arg | test-source |
|
|
| test.py:104:24:104:29 | param1 | test-source |
|
|
| test.py:104:32:104:37 | param2 | test-source |
|
|
| test.py:107:24:107:28 | name1 | test-source |
|
|
| test.py:107:31:107:35 | name2 | test-source |
|
|
| test.py:114:19:114:29 | After getSource() | test-source |
|
|
| test.py:115:20:115:30 | After getSource() | test-source |
|
|
| test.py:116:31:116:41 | After getSource() | test-source |
|
|
| test.py:117:31:117:41 | After getSource() | test-source |
|
|
| test.py:118:35:118:45 | After getSource() | test-source |
|
|
| test.py:119:20:119:30 | After getSource() | test-source |
|
|
| test.py:124:1:124:33 | After Attribute() | test-source |
|
|
| test.py:126:11:126:43 | After Attribute() | test-source |
|
|
| test.py:129:11:129:39 | After Attribute() | test-source |
|
|
syntaxErrors
|
|
| Member[foo |
|
|
| Member[foo] .Member[bar] |
|
|
| Member[foo] Member[bar] |
|
|
| Member[foo], Member[bar] |
|
|
| Member[foo],Member[bar] |
|
|
| Member[foo]. Member[bar] |
|
|
| Member[foo]..Member[bar] |
|
|
| Member[foo]Member[bar] |
|
|
| Member[foo]] |
|
|
| Member[foo]].Member[bar] |
|
|
warning
|