mirror of
https://github.com/github/codeql.git
synced 2026-08-02 08:23:01 +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>
69 lines
6.1 KiB
Plaintext
69 lines
6.1 KiB
Plaintext
#select
|
|
| flask_tests.py:13:17:13:26 | rfs_header | flask_tests.py:1:29:1:35 | ImportMember | flask_tests.py:13:17:13:26 | rfs_header | This HTTP header is constructed from a $@. | flask_tests.py:1:29:1:35 | ImportMember | user-provided value |
|
|
| flask_tests.py:20:36:20:61 | Subscript | flask_tests.py:1:29:1:35 | ImportMember | flask_tests.py:20:36:20:61 | Subscript | This HTTP header is constructed from a $@. | flask_tests.py:1:29:1:35 | ImportMember | user-provided value |
|
|
| flask_tests.py:33:11:33:20 | rfs_header | flask_tests.py:1:29:1:35 | ImportMember | flask_tests.py:33:11:33:20 | rfs_header | This HTTP header is constructed from a $@. | flask_tests.py:1:29:1:35 | ImportMember | user-provided value |
|
|
| flask_tests.py:35:12:35:21 | rfs_header | flask_tests.py:1:29:1:35 | ImportMember | flask_tests.py:35:12:35:21 | rfs_header | This HTTP header is constructed from a $@. | flask_tests.py:1:29:1:35 | ImportMember | user-provided value |
|
|
| http_test.py:12:40:12:50 | input_value | http_test.py:5:16:5:19 | self | http_test.py:12:40:12:50 | input_value | This HTTP header is constructed from a $@. | http_test.py:5:16:5:19 | self | user-provided value |
|
|
| wsgiref_tests.py:8:17:8:22 | h_name | wsgiref_tests.py:4:14:4:20 | environ | wsgiref_tests.py:8:17:8:22 | h_name | This HTTP header is constructed from a $@. | wsgiref_tests.py:4:14:4:20 | environ | user-provided value |
|
|
| wsgiref_tests.py:8:42:8:46 | h_val | wsgiref_tests.py:4:14:4:20 | environ | wsgiref_tests.py:8:42:8:46 | h_val | This HTTP header is constructed from a $@. | wsgiref_tests.py:4:14:4:20 | environ | user-provided value |
|
|
edges
|
|
| flask_tests.py:1:29:1:35 | ImportMember | flask_tests.py:1:29:1:35 | request | provenance | |
|
|
| flask_tests.py:1:29:1:35 | request | flask_tests.py:9:18:9:24 | request | provenance | |
|
|
| flask_tests.py:1:29:1:35 | request | flask_tests.py:19:18:19:24 | request | provenance | |
|
|
| flask_tests.py:1:29:1:35 | request | flask_tests.py:20:36:20:42 | request | provenance | |
|
|
| flask_tests.py:1:29:1:35 | request | flask_tests.py:31:18:31:24 | request | provenance | |
|
|
| flask_tests.py:9:5:9:14 | rfs_header | flask_tests.py:13:17:13:26 | rfs_header | provenance | |
|
|
| flask_tests.py:9:18:9:24 | request | flask_tests.py:9:5:9:14 | rfs_header | provenance | AdditionalTaintStep |
|
|
| flask_tests.py:19:18:19:24 | request | flask_tests.py:20:36:20:61 | Subscript | provenance | AdditionalTaintStep |
|
|
| flask_tests.py:20:36:20:42 | request | flask_tests.py:20:36:20:61 | Subscript | provenance | AdditionalTaintStep |
|
|
| flask_tests.py:31:5:31:14 | rfs_header | flask_tests.py:33:11:33:20 | rfs_header | provenance | |
|
|
| flask_tests.py:31:5:31:14 | rfs_header | flask_tests.py:35:12:35:21 | rfs_header | provenance | |
|
|
| flask_tests.py:31:18:31:24 | request | flask_tests.py:31:5:31:14 | rfs_header | provenance | AdditionalTaintStep |
|
|
| http_test.py:5:16:5:19 | self | http_test.py:6:45:6:53 | Attribute | provenance | AdditionalTaintStep |
|
|
| http_test.py:6:9:6:19 | parsed_path | http_test.py:7:40:7:56 | Attribute | provenance | AdditionalTaintStep |
|
|
| http_test.py:6:23:6:54 | Attribute() | http_test.py:6:9:6:19 | parsed_path | provenance | |
|
|
| http_test.py:6:45:6:53 | Attribute | http_test.py:6:23:6:54 | Attribute() | provenance | MaD:2 |
|
|
| http_test.py:7:9:7:14 | params | http_test.py:8:23:8:28 | params | provenance | |
|
|
| http_test.py:7:18:7:57 | Attribute() | http_test.py:7:9:7:14 | params | provenance | |
|
|
| http_test.py:7:40:7:56 | Attribute | http_test.py:7:18:7:57 | Attribute() | provenance | MaD:1 |
|
|
| http_test.py:8:9:8:19 | input_value | http_test.py:12:40:12:50 | input_value | provenance | |
|
|
| http_test.py:8:23:8:28 | params | http_test.py:8:23:8:47 | Attribute() | provenance | dict.get |
|
|
| http_test.py:8:23:8:47 | Attribute() | http_test.py:8:9:8:19 | input_value | provenance | |
|
|
| wsgiref_tests.py:4:14:4:20 | environ | wsgiref_tests.py:6:5:6:10 | h_name | provenance | |
|
|
| wsgiref_tests.py:4:14:4:20 | environ | wsgiref_tests.py:7:5:7:9 | h_val | provenance | |
|
|
| wsgiref_tests.py:6:5:6:10 | h_name | wsgiref_tests.py:8:17:8:22 | h_name | provenance | |
|
|
| wsgiref_tests.py:7:5:7:9 | h_val | wsgiref_tests.py:8:42:8:46 | h_val | provenance | |
|
|
models
|
|
| 1 | Summary: urllib; Member[parse].Member[parse_qs]; Argument[0,qs:]; ReturnValue; taint |
|
|
| 2 | Summary: urllib; Member[parse].Member[urlparse]; Argument[0,urlstring:]; ReturnValue; taint |
|
|
nodes
|
|
| flask_tests.py:1:29:1:35 | ImportMember | semmle.label | ImportMember |
|
|
| flask_tests.py:1:29:1:35 | request | semmle.label | request |
|
|
| flask_tests.py:9:5:9:14 | rfs_header | semmle.label | rfs_header |
|
|
| flask_tests.py:9:18:9:24 | request | semmle.label | request |
|
|
| flask_tests.py:13:17:13:26 | rfs_header | semmle.label | rfs_header |
|
|
| flask_tests.py:19:18:19:24 | request | semmle.label | request |
|
|
| flask_tests.py:20:36:20:42 | request | semmle.label | request |
|
|
| flask_tests.py:20:36:20:61 | Subscript | semmle.label | Subscript |
|
|
| flask_tests.py:31:5:31:14 | rfs_header | semmle.label | rfs_header |
|
|
| flask_tests.py:31:18:31:24 | request | semmle.label | request |
|
|
| flask_tests.py:33:11:33:20 | rfs_header | semmle.label | rfs_header |
|
|
| flask_tests.py:35:12:35:21 | rfs_header | semmle.label | rfs_header |
|
|
| http_test.py:5:16:5:19 | self | semmle.label | self |
|
|
| http_test.py:6:9:6:19 | parsed_path | semmle.label | parsed_path |
|
|
| http_test.py:6:23:6:54 | Attribute() | semmle.label | Attribute() |
|
|
| http_test.py:6:45:6:53 | Attribute | semmle.label | Attribute |
|
|
| http_test.py:7:9:7:14 | params | semmle.label | params |
|
|
| http_test.py:7:18:7:57 | Attribute() | semmle.label | Attribute() |
|
|
| http_test.py:7:40:7:56 | Attribute | semmle.label | Attribute |
|
|
| http_test.py:8:9:8:19 | input_value | semmle.label | input_value |
|
|
| http_test.py:8:23:8:28 | params | semmle.label | params |
|
|
| http_test.py:8:23:8:47 | Attribute() | semmle.label | Attribute() |
|
|
| http_test.py:12:40:12:50 | input_value | semmle.label | input_value |
|
|
| wsgiref_tests.py:4:14:4:20 | environ | semmle.label | environ |
|
|
| wsgiref_tests.py:6:5:6:10 | h_name | semmle.label | h_name |
|
|
| wsgiref_tests.py:7:5:7:9 | h_val | semmle.label | h_val |
|
|
| wsgiref_tests.py:8:17:8:22 | h_name | semmle.label | h_name |
|
|
| wsgiref_tests.py:8:42:8:46 | h_val | semmle.label | h_val |
|
|
subpaths
|