mirror of
https://github.com/github/codeql.git
synced 2026-06-23 05:37:02 +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>
45 lines
4.5 KiB
Plaintext
45 lines
4.5 KiB
Plaintext
edges
|
|
| app_unsafe.py:4:1:4:9 | aConstant | app_unsafe.py:5:28:5:36 | aConstant | provenance | |
|
|
| app_unsafe.py:4:1:4:9 | aConstant | app_unsafe.py:6:18:6:26 | aConstant | provenance | |
|
|
| app_unsafe.py:4:1:4:9 | aConstant | app_unsafe.py:7:30:7:38 | aConstant | provenance | |
|
|
| app_unsafe.py:4:1:4:9 | aConstant | app_unsafe.py:8:36:8:44 | aConstant | provenance | |
|
|
| app_unsafe.py:4:13:4:23 | StringLiteral | app_unsafe.py:4:1:4:9 | aConstant | provenance | |
|
|
| config.py:7:1:7:9 | aConstant | config.py:12:18:12:26 | aConstant | provenance | |
|
|
| config.py:7:1:7:9 | aConstant | config.py:12:18:12:26 | aConstant | provenance | |
|
|
| config.py:7:1:7:9 | aConstant | config.py:17:38:17:46 | aConstant | provenance | |
|
|
| config.py:7:1:7:9 | aConstant | config.py:18:43:18:51 | aConstant | provenance | |
|
|
| config.py:7:13:7:23 | StringLiteral | config.py:7:1:7:9 | aConstant | provenance | |
|
|
| config.py:12:18:12:26 | aConstant | config.py:17:38:17:46 | aConstant | provenance | |
|
|
| config.py:12:18:12:26 | aConstant | config.py:18:43:18:51 | aConstant | provenance | |
|
|
| config.py:17:38:17:46 | aConstant | config.py:17:18:17:47 | After Attribute() | provenance | os.getenv |
|
|
| config.py:17:38:17:46 | aConstant | config.py:18:43:18:51 | aConstant | provenance | |
|
|
| config.py:18:43:18:51 | aConstant | config.py:18:18:18:52 | After Attribute() | provenance | dict.get |
|
|
nodes
|
|
| app_safe.py:5:28:5:37 | StringLiteral | semmle.label | StringLiteral |
|
|
| app_unsafe.py:4:1:4:9 | aConstant | semmle.label | aConstant |
|
|
| app_unsafe.py:4:13:4:23 | StringLiteral | semmle.label | StringLiteral |
|
|
| app_unsafe.py:5:28:5:36 | aConstant | semmle.label | aConstant |
|
|
| app_unsafe.py:6:18:6:26 | aConstant | semmle.label | aConstant |
|
|
| app_unsafe.py:7:30:7:38 | aConstant | semmle.label | aConstant |
|
|
| app_unsafe.py:8:36:8:44 | aConstant | semmle.label | aConstant |
|
|
| config2.py:5:14:5:24 | StringLiteral | semmle.label | StringLiteral |
|
|
| config.py:7:1:7:9 | aConstant | semmle.label | aConstant |
|
|
| config.py:7:13:7:23 | StringLiteral | semmle.label | StringLiteral |
|
|
| config.py:12:18:12:26 | aConstant | semmle.label | aConstant |
|
|
| config.py:12:18:12:26 | aConstant | semmle.label | aConstant |
|
|
| config.py:17:18:17:47 | After Attribute() | semmle.label | After Attribute() |
|
|
| config.py:17:38:17:46 | aConstant | semmle.label | aConstant |
|
|
| config.py:18:18:18:52 | After Attribute() | semmle.label | After Attribute() |
|
|
| config.py:18:43:18:51 | aConstant | semmle.label | aConstant |
|
|
subpaths
|
|
#select
|
|
| app_safe.py:5:28:5:37 | StringLiteral | app_safe.py:5:28:5:37 | StringLiteral | app_safe.py:5:28:5:37 | StringLiteral | The SECRET_KEY config variable is assigned by $@. | app_safe.py:5:28:5:37 | StringLiteral | this constant String |
|
|
| app_unsafe.py:5:28:5:36 | aConstant | app_unsafe.py:4:13:4:23 | StringLiteral | app_unsafe.py:5:28:5:36 | aConstant | The SECRET_KEY config variable is assigned by $@. | app_unsafe.py:4:13:4:23 | StringLiteral | this constant String |
|
|
| app_unsafe.py:6:18:6:26 | aConstant | app_unsafe.py:4:13:4:23 | StringLiteral | app_unsafe.py:6:18:6:26 | aConstant | The SECRET_KEY config variable is assigned by $@. | app_unsafe.py:4:13:4:23 | StringLiteral | this constant String |
|
|
| app_unsafe.py:7:30:7:38 | aConstant | app_unsafe.py:4:13:4:23 | StringLiteral | app_unsafe.py:7:30:7:38 | aConstant | The SECRET_KEY config variable is assigned by $@. | app_unsafe.py:4:13:4:23 | StringLiteral | this constant String |
|
|
| app_unsafe.py:8:36:8:44 | aConstant | app_unsafe.py:4:13:4:23 | StringLiteral | app_unsafe.py:8:36:8:44 | aConstant | The SECRET_KEY config variable is assigned by $@. | app_unsafe.py:4:13:4:23 | StringLiteral | this constant String |
|
|
| config2.py:5:14:5:24 | StringLiteral | config2.py:5:14:5:24 | StringLiteral | config2.py:5:14:5:24 | StringLiteral | The SECRET_KEY config variable is assigned by $@. | config2.py:5:14:5:24 | StringLiteral | this constant String |
|
|
| config.py:12:18:12:26 | aConstant | config.py:7:13:7:23 | StringLiteral | config.py:12:18:12:26 | aConstant | The SECRET_KEY config variable is assigned by $@. | config.py:7:13:7:23 | StringLiteral | this constant String |
|
|
| config.py:17:18:17:47 | After Attribute() | config.py:7:13:7:23 | StringLiteral | config.py:17:18:17:47 | After Attribute() | The SECRET_KEY config variable is assigned by $@. | config.py:7:13:7:23 | StringLiteral | this constant String |
|
|
| config.py:18:18:18:52 | After Attribute() | config.py:7:13:7:23 | StringLiteral | config.py:18:18:18:52 | After Attribute() | The SECRET_KEY config variable is assigned by $@. | config.py:7:13:7:23 | StringLiteral | this constant String |
|