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 {
115115 override SensitiveDataClassification getClassification ( ) { result = classification }
116116 }
117117
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+
118137 /**
119138 * Holds if the step from `nodeFrom` to `nodeTo` should be considered a
120139 * taint-flow step for sensitive-data, to ensure calls are handled correctly.
@@ -147,7 +166,10 @@ private module SensitiveDataModeling {
147166 * ```
148167 */
149168 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 ( )
151173 }
152174
153175 /**
You can’t perform that action at this time.
0 commit comments