mirror of
https://github.com/github/codeql.git
synced 2026-06-03 12:50:16 +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>
121 lines
8.9 KiB
Plaintext
121 lines
8.9 KiB
Plaintext
| attr_clash.__init__ | __file__ | attr_clash/__init__.py:6:6:6:13 | __file__ |
|
|
| attr_clash.__init__ | clashing_attr | attr_clash/__init__.py:4:1:4:13 | clashing_attr |
|
|
| attr_clash.__init__ | enter | attr_clash/__init__.py:2:1:2:5 | enter |
|
|
| attr_clash.__init__ | exit | attr_clash/__init__.py:6:1:6:4 | exit |
|
|
| attr_clash.clashing_attr | __file__ | attr_clash/clashing_attr.py:4:6:4:13 | __file__ |
|
|
| attr_clash.clashing_attr | enter | attr_clash/clashing_attr.py:2:1:2:5 | enter |
|
|
| attr_clash.clashing_attr | exit | attr_clash/clashing_attr.py:4:1:4:4 | exit |
|
|
| attr_clash.non_clashing_submodule | __file__ | attr_clash/non_clashing_submodule.py:4:6:4:13 | __file__ |
|
|
| attr_clash.non_clashing_submodule | enter | attr_clash/non_clashing_submodule.py:2:1:2:5 | enter |
|
|
| attr_clash.non_clashing_submodule | exit | attr_clash/non_clashing_submodule.py:4:1:4:4 | exit |
|
|
| bar | __file__ | bar.py:6:6:6:13 | __file__ |
|
|
| bar | bar_attr | bar.py:4:1:4:8 | bar_attr |
|
|
| bar | enter | bar.py:2:1:2:5 | enter |
|
|
| bar | exit | bar.py:6:1:6:4 | exit |
|
|
| baz | __file__ | baz.py:6:6:6:13 | __file__ |
|
|
| baz | baz_attr | baz.py:4:1:4:8 | baz_attr |
|
|
| baz | enter | baz.py:2:1:2:5 | enter |
|
|
| baz | exit | baz.py:6:1:6:4 | exit |
|
|
| block_flow_check | SOURCE | block_flow_check.py:12:25:12:30 | SOURCE |
|
|
| block_flow_check | __file__ | block_flow_check.py:14:6:14:13 | __file__ |
|
|
| block_flow_check | check | block_flow_check.py:12:1:12:5 | check |
|
|
| block_flow_check | enter | block_flow_check.py:2:1:2:5 | enter |
|
|
| block_flow_check | exit | block_flow_check.py:14:1:14:4 | exit |
|
|
| block_flow_check | globals | block_flow_check.py:12:33:12:39 | globals |
|
|
| block_flow_check | object | block_flow_check.py:4:14:4:19 | object |
|
|
| foo | __file__ | foo.py:14:6:14:13 | __file__ |
|
|
| foo | __private_foo_attr | foo.py:8:1:8:18 | __private_foo_attr |
|
|
| foo | bar_reexported | foo.py:11:8:11:10 | ImportExpr |
|
|
| foo | bar_reexported | foo.py:12:34:12:47 | bar_reexported |
|
|
| foo | check | foo.py:12:1:12:5 | check |
|
|
| foo | enter | foo.py:2:1:2:5 | enter |
|
|
| foo | exit | foo.py:14:1:14:4 | exit |
|
|
| foo | foo_attr | foo.py:5:1:5:8 | foo_attr |
|
|
| foo | globals | foo.py:12:71:12:77 | globals |
|
|
| generous_export | Exception | generous_export.py:16:11:16:19 | Exception |
|
|
| generous_export | SOURCE | generous_export.py:15:11:15:16 | SOURCE |
|
|
| generous_export | SOURCE | generous_export.py:20:25:20:30 | SOURCE |
|
|
| generous_export | __file__ | generous_export.py:22:6:22:13 | __file__ |
|
|
| generous_export | check | generous_export.py:20:1:20:5 | check |
|
|
| generous_export | enter | generous_export.py:2:1:2:5 | enter |
|
|
| generous_export | eval | generous_export.py:10:4:10:7 | eval |
|
|
| generous_export | exit | generous_export.py:22:1:22:4 | exit |
|
|
| generous_export | globals | generous_export.py:20:33:20:39 | globals |
|
|
| generous_export | object | generous_export.py:4:14:4:19 | object |
|
|
| generous_export | print | generous_export.py:15:5:15:9 | print |
|
|
| has_defined_all | __all__ | has_defined_all.py:7:1:7:7 | __all__ |
|
|
| has_defined_all | __file__ | has_defined_all.py:9:6:9:13 | __file__ |
|
|
| has_defined_all | all_defined_bar | has_defined_all.py:5:1:5:15 | all_defined_bar |
|
|
| has_defined_all | all_defined_foo | has_defined_all.py:4:1:4:15 | all_defined_foo |
|
|
| has_defined_all | enter | has_defined_all.py:2:1:2:5 | enter |
|
|
| has_defined_all | exit | has_defined_all.py:9:1:9:4 | exit |
|
|
| has_defined_all_copy | __all__ | has_defined_all_copy.py:9:1:9:7 | __all__ |
|
|
| has_defined_all_copy | __file__ | has_defined_all_copy.py:11:6:11:13 | __file__ |
|
|
| has_defined_all_copy | all_defined_bar_copy | has_defined_all_copy.py:7:1:7:20 | all_defined_bar_copy |
|
|
| has_defined_all_copy | all_defined_foo_copy | has_defined_all_copy.py:6:1:6:20 | all_defined_foo_copy |
|
|
| has_defined_all_copy | enter | has_defined_all_copy.py:4:1:4:5 | enter |
|
|
| has_defined_all_copy | exit | has_defined_all_copy.py:11:1:11:4 | exit |
|
|
| has_defined_all_indirection | __file__ | has_defined_all_indirection.py:6:6:6:13 | __file__ |
|
|
| has_defined_all_indirection | all_defined_foo_copy | has_defined_all_copy.py:6:1:6:20 | all_defined_foo_copy |
|
|
| has_defined_all_indirection | enter | has_defined_all_indirection.py:2:1:2:5 | enter |
|
|
| has_defined_all_indirection | exit | has_defined_all_indirection.py:6:1:6:4 | exit |
|
|
| if_then_else | __file__ | if_then_else.py:16:6:16:13 | __file__ |
|
|
| if_then_else | enter | if_then_else.py:2:1:2:5 | enter |
|
|
| if_then_else | eval | if_then_else.py:11:8:11:11 | eval |
|
|
| if_then_else | exit | if_then_else.py:16:1:16:4 | exit |
|
|
| if_then_else | if_then_else_defined | if_then_else.py:7:5:7:24 | if_then_else_defined |
|
|
| if_then_else | if_then_else_defined | if_then_else.py:12:9:12:28 | if_then_else_defined |
|
|
| if_then_else | if_then_else_defined | if_then_else.py:14:9:14:28 | if_then_else_defined |
|
|
| if_then_else_refined | SOURCE | if_then_else_refined.py:11:11:11:16 | SOURCE |
|
|
| if_then_else_refined | SOURCE | if_then_else_refined.py:13:11:13:16 | SOURCE |
|
|
| if_then_else_refined | __file__ | if_then_else_refined.py:19:6:19:13 | __file__ |
|
|
| if_then_else_refined | check | if_then_else_refined.py:17:1:17:5 | check |
|
|
| if_then_else_refined | enter | if_then_else_refined.py:4:1:4:5 | enter |
|
|
| if_then_else_refined | eval | if_then_else_refined.py:10:4:10:7 | eval |
|
|
| if_then_else_refined | exit | if_then_else_refined.py:19:1:19:4 | exit |
|
|
| if_then_else_refined | globals | if_then_else_refined.py:17:24:17:30 | globals |
|
|
| if_then_else_refined | src | if_then_else_refined.py:17:19:17:21 | src |
|
|
| package.__init__ | __file__ | package/__init__.py:7:6:7:13 | __file__ |
|
|
| package.__init__ | attr_used_in_subpackage | package/__init__.py:4:1:4:23 | attr_used_in_subpackage |
|
|
| package.__init__ | enter | package/__init__.py:2:1:2:5 | enter |
|
|
| package.__init__ | exit | package/__init__.py:7:1:7:4 | exit |
|
|
| package.__init__ | package_attr | package/__init__.py:5:1:5:12 | package_attr |
|
|
| package.subpackage2.__init__ | __file__ | package/subpackage2/__init__.py:6:6:6:13 | __file__ |
|
|
| package.subpackage2.__init__ | enter | package/subpackage2/__init__.py:2:1:2:5 | enter |
|
|
| package.subpackage2.__init__ | exit | package/subpackage2/__init__.py:6:1:6:4 | exit |
|
|
| package.subpackage2.__init__ | subpackage2_attr | package/subpackage2/__init__.py:4:1:4:16 | subpackage2_attr |
|
|
| package.subpackage.__init__ | __file__ | package/subpackage/__init__.py:14:6:14:13 | __file__ |
|
|
| package.subpackage.__init__ | check | package/subpackage/__init__.py:12:1:12:5 | check |
|
|
| package.subpackage.__init__ | enter | package/subpackage/__init__.py:2:1:2:5 | enter |
|
|
| package.subpackage.__init__ | exit | package/subpackage/__init__.py:14:1:14:4 | exit |
|
|
| package.subpackage.__init__ | globals | package/subpackage/__init__.py:12:79:12:85 | globals |
|
|
| package.subpackage.__init__ | imported_attr | package/subpackage/__init__.py:7:16:7:55 | After ImportMember |
|
|
| package.subpackage.__init__ | imported_attr | package/subpackage/__init__.py:8:24:8:36 | imported_attr |
|
|
| package.subpackage.__init__ | irrelevant_attr | package/subpackage/__init__.py:11:24:11:38 | After ImportMember |
|
|
| package.subpackage.__init__ | irrelevant_attr | package/subpackage/__init__.py:11:24:11:38 | irrelevant_attr |
|
|
| package.subpackage.__init__ | submodule | package/subpackage/__init__.py:12:35:12:43 | submodule |
|
|
| package.subpackage.__init__ | subpackage_attr | package/subpackage/__init__.py:4:1:4:15 | subpackage_attr |
|
|
| package.subpackage.submodule | __file__ | package/subpackage/submodule.py:7:6:7:13 | __file__ |
|
|
| package.subpackage.submodule | enter | package/subpackage/submodule.py:2:1:2:5 | enter |
|
|
| package.subpackage.submodule | exit | package/subpackage/submodule.py:7:1:7:4 | exit |
|
|
| package.subpackage.submodule | irrelevant_attr | package/subpackage/submodule.py:5:1:5:15 | irrelevant_attr |
|
|
| package.subpackage.submodule | submodule_attr | package/subpackage/submodule.py:4:1:4:14 | submodule_attr |
|
|
| refined | SOURCE | refined.py:12:25:12:30 | SOURCE |
|
|
| refined | __file__ | refined.py:14:6:14:13 | __file__ |
|
|
| refined | check | refined.py:12:1:12:5 | check |
|
|
| refined | enter | refined.py:2:1:2:5 | enter |
|
|
| refined | exit | refined.py:14:1:14:4 | exit |
|
|
| refined | globals | refined.py:12:33:12:39 | globals |
|
|
| refined | object | refined.py:4:14:4:19 | object |
|
|
| simplistic_reexport | __file__ | simplistic_reexport.py:19:6:19:13 | __file__ |
|
|
| simplistic_reexport | bar_attr | simplistic_reexport.py:6:17:6:24 | After ImportMember |
|
|
| simplistic_reexport | bar_attr | simplistic_reexport.py:10:19:10:26 | bar_attr |
|
|
| simplistic_reexport | baz_attr | baz.py:4:1:4:8 | baz_attr |
|
|
| simplistic_reexport | baz_attr | simplistic_reexport.py:17:19:17:26 | baz_attr |
|
|
| simplistic_reexport | check | simplistic_reexport.py:17:1:17:5 | check |
|
|
| simplistic_reexport | enter | baz.py:2:1:2:5 | enter |
|
|
| simplistic_reexport | enter | simplistic_reexport.py:4:1:4:5 | enter |
|
|
| simplistic_reexport | exit | baz.py:6:1:6:4 | exit |
|
|
| simplistic_reexport | exit | simplistic_reexport.py:19:1:19:4 | exit |
|
|
| simplistic_reexport | globals | simplistic_reexport.py:17:44:17:50 | globals |
|