11private import rust
2+ private import codeql.dataflow.DataFlow as DF
23private import codeql.dataflow.TaintTracking
3- private import codeql.rust.dataflow.DataFlow
4+ private import codeql.rust.dataflow.DataFlow as RustDataFlow
45private import codeql.rust.dataflow.FlowSummary
5- private import DataFlowImpl
6+ private import DataFlowImpl as DataFlowImpl
67private import Node as Node
78private import Content
89private import FlowSummaryImpl as FlowSummaryImpl
@@ -29,7 +30,11 @@ private predicate excludedTaintStepContent(Content c) {
2930 )
3031}
3132
32- module RustTaintTracking implements InputSig< Location , RustDataFlow > {
33+ module RustTaintTrackingGen< DataFlowImpl:: RustDataFlowInputSig I> implements
34+ InputSig< Location , DataFlowImpl:: RustDataFlowGen< I > >
35+ {
36+ private module DataFlow = DataFlowImpl:: RustDataFlowGen< I > ;
37+
3338 predicate defaultTaintSanitizer ( DataFlow:: Node node ) { none ( ) }
3439
3540 /**
@@ -53,7 +58,7 @@ module RustTaintTracking implements InputSig<Location, RustDataFlow> {
5358 // is tainted and an operation reads from `foo` (e.g., `foo.bar`) then
5459 // taint is propagated.
5560 exists ( ContentSet cs |
56- RustDataFlow :: readStep ( pred , cs , succ ) and
61+ DataFlow :: readStep ( pred , cs , succ ) and
5762 not excludedTaintStepContent ( cs .getAReadContent ( ) )
5863 )
5964 or
@@ -70,9 +75,11 @@ module RustTaintTracking implements InputSig<Location, RustDataFlow> {
7075 )
7176 or
7277 succ .( Node:: PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( ) =
73- getPostUpdateReverseStep ( pred .( Node:: PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( ) , false )
78+ DataFlowImpl:: getPostUpdateReverseStep ( pred .( Node:: PostUpdateNode )
79+ .getPreUpdateNode ( )
80+ .asExpr ( ) , false )
7481 or
75- indexAssignment ( any ( CompoundAssignmentExpr cae ) ,
82+ DataFlowImpl :: indexAssignment ( any ( CompoundAssignmentExpr cae ) ,
7683 pred .( Node:: PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( ) , _, succ , _)
7784 )
7885 or
@@ -92,7 +99,7 @@ module RustTaintTracking implements InputSig<Location, RustDataFlow> {
9299 c instanceof ReferenceContent
93100 ) and
94101 // Optional steps are added through isAdditionalFlowStep but we don't want the implicit reads
95- not optionalStep ( node , _, _)
102+ not DataFlowImpl :: optionalStep ( node , _, _)
96103 }
97104
98105 /**
@@ -101,3 +108,5 @@ module RustTaintTracking implements InputSig<Location, RustDataFlow> {
101108 */
102109 predicate speculativeTaintStep ( DataFlow:: Node src , DataFlow:: Node sink ) { none ( ) }
103110}
111+
112+ module RustTaintTracking = RustTaintTrackingGen< DataFlowImpl:: RustDataFlowInput > ;
0 commit comments