File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
python/ql/src/semmle/python/dataflow/new Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,25 @@ private module SensitiveDataModeling {
115
115
override SensitiveDataClassification getClassification ( ) { result = classification }
116
116
}
117
117
118
+ /**
119
+ * Tracks any modeled source of sensitive data (with any classification),
120
+ * to limit the scope of `extraStepForCalls`. See it's QLDoc for more context.
121
+ */
122
+ private DataFlow:: LocalSourceNode possibleSensitiveCallable ( DataFlow:: TypeTracker t ) {
123
+ t .start ( ) and
124
+ result instanceof SensitiveDataSource
125
+ or
126
+ exists ( DataFlow:: TypeTracker t2 | result = possibleSensitiveCallable ( t2 ) .track ( t2 , t ) )
127
+ }
128
+
129
+ /**
130
+ * Tracks any modeled source of sensitive data (with any classification),
131
+ * to limit the scope of `extraStepForCalls`. See it's QLDoc for more context.
132
+ */
133
+ private DataFlow:: Node possibleSensitiveCallable ( ) {
134
+ possibleSensitiveCallable ( DataFlow:: TypeTracker:: end ( ) ) .flowsTo ( result )
135
+ }
136
+
118
137
/**
119
138
* Holds if the step from `nodeFrom` to `nodeTo` should be considered a
120
139
* taint-flow step for sensitive-data, to ensure calls are handled correctly.
@@ -147,7 +166,10 @@ private module SensitiveDataModeling {
147
166
* ```
148
167
*/
149
168
predicate extraStepForCalls ( DataFlow:: Node nodeFrom , DataFlow:: CallCfgNode nodeTo ) {
150
- nodeTo .getFunction ( ) = nodeFrom
169
+ // However, we do still use the type-tracking approach to limit the size of this
170
+ // predicate.
171
+ nodeTo .getFunction ( ) = nodeFrom and
172
+ nodeFrom = possibleSensitiveCallable ( )
151
173
}
152
174
153
175
/**
You can’t perform that action at this time.
0 commit comments