Skip to content

Commit 78c33ab

Browse files
committed
Python: Remove points-to references from python.qll
For now, these have just been made into `private` imports. After doing this, I went through all of the (now not compiling) files and added in private imports to the modules that they actually depended on. I also added an explicit import of `LegacyPointsTo` (even though it may be unnecessary) in cases where the points-to dependency was somewhat surprising (and one we want to get rid of). This was primarily inside the various SSA layers. For modules inside `semmle.python.{types, objects, pointsto}` I did not bother, as these are fairly clearly related to points-to.
1 parent 85cb3e0 commit 78c33ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+73
-39
lines changed

python/ql/lib/LegacyPointsTo.qll

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,21 @@
2020
*/
2121

2222
private import python
23-
private import semmle.python.pointsto.PointsTo
24-
private import semmle.python.objects.Modules
23+
import semmle.python.pointsto.Base
24+
import semmle.python.pointsto.Context
25+
import semmle.python.pointsto.PointsTo
26+
import semmle.python.pointsto.PointsToContext
27+
import semmle.python.objects.ObjectAPI
28+
import semmle.python.objects.ObjectInternal
29+
import semmle.python.types.Object
30+
import semmle.python.types.ClassObject
31+
import semmle.python.types.FunctionObject
32+
import semmle.python.types.ModuleObject
33+
import semmle.python.types.Exceptions
34+
import semmle.python.types.Properties
35+
import semmle.python.types.ImportTime
36+
import semmle.python.types.Descriptors
37+
import semmle.python.SelfAttribute
2538

2639
/**
2740
* An extension of `ControlFlowNode` that provides points-to predicates.

python/ql/lib/analysis/DefinitionTracking.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import python
66
private import LegacyPointsTo
7-
import semmle.python.pointsto.PointsTo
87
import IDEContextual
98

109
private newtype TDefinition =

python/ql/lib/python.qll

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ import semmle.python.Constants
1919
import semmle.python.Scope
2020
import semmle.python.Comment
2121
import semmle.python.GuardedControlFlow
22-
import semmle.python.types.ImportTime
23-
import semmle.python.types.Object
24-
import semmle.python.types.ClassObject
25-
import semmle.python.types.FunctionObject
26-
import semmle.python.types.ModuleObject
27-
import semmle.python.types.Version
28-
import semmle.python.types.Descriptors
22+
private import semmle.python.types.ImportTime
23+
private import semmle.python.types.Object
24+
private import semmle.python.types.ClassObject
25+
private import semmle.python.types.FunctionObject
26+
private import semmle.python.types.ModuleObject
27+
private import semmle.python.types.Version
28+
private import semmle.python.types.Descriptors
2929
import semmle.python.SSA
30-
import semmle.python.SelfAttribute
31-
import semmle.python.types.Properties
30+
private import semmle.python.SelfAttribute
31+
private import semmle.python.types.Properties
3232
import semmle.python.xml.XML
3333
import semmle.python.essa.Essa
34-
import semmle.python.pointsto.Base
35-
import semmle.python.pointsto.Context
36-
import semmle.python.pointsto.CallGraph
37-
import semmle.python.objects.ObjectAPI
34+
private import semmle.python.pointsto.Base
35+
private import semmle.python.pointsto.Context
36+
private import semmle.python.pointsto.CallGraph
37+
private import semmle.python.objects.ObjectAPI
3838
import semmle.python.Unit
3939
import site
4040
private import semmle.python.Overlay

python/ql/lib/semmle/python/Flow.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import python
22
private import semmle.python.internal.CachedStages
33
private import codeql.controlflow.BasicBlock as BB
4+
private import LegacyPointsTo
45

56
/*
67
* Note about matching parent and child nodes and CFG splitting:

python/ql/lib/semmle/python/SSA.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** SSA library */
22

33
import python
4+
private import LegacyPointsTo
45

56
/**
67
* A single static assignment variable.

python/ql/lib/semmle/python/SelfAttribute.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import python
77
private import semmle.python.pointsto.Filters
8+
private import LegacyPointsTo
89

910
/**
1011
* An attribute access where the left hand side of the attribute expression

python/ql/lib/semmle/python/dataflow/new/internal/ImportResolution.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ private import semmle.python.dataflow.new.DataFlow
99
private import semmle.python.dataflow.new.internal.ImportStar
1010
private import semmle.python.dataflow.new.TypeTracking
1111
private import semmle.python.dataflow.new.internal.DataFlowPrivate
12+
private import semmle.python.essa.SsaDefinitions
1213

1314
/**
1415
* Python modules and the way imports are resolved are... complicated. Here's a crash course in how

python/ql/lib/semmle/python/dataflow/old/Configuration.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import python
22
import semmle.python.dataflow.TaintTracking
3-
private import semmle.python.objects.ObjectInternal
3+
private import LegacyPointsTo
44
private import semmle.python.dataflow.Implementation
55

66
module TaintTracking {

python/ql/lib/semmle/python/dataflow/old/Files.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import python
2+
private import LegacyPointsTo
23
import semmle.python.dataflow.TaintTracking
34

45
class OpenFile extends TaintKind {

python/ql/lib/semmle/python/dataflow/old/Implementation.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import python
22
private import LegacyPointsTo
33
import semmle.python.dataflow.TaintTracking
4-
private import semmle.python.objects.ObjectInternal
54
private import semmle.python.pointsto.Filters as Filters
65
import semmle.python.dataflow.Legacy
76

0 commit comments

Comments
 (0)