@@ -27,30 +27,32 @@ private class ConcreteMaybeFromProto extends MaybeFromProto {
2727/**
2828 * A taint-tracking configuration for reasoning about unvalidated dynamic method calls.
2929 */
30- class Configuration extends TaintTracking :: Configuration {
31- Configuration ( ) { this = "UnvalidatedDynamicMethodCall" }
30+ module UnvalidatedDynamicMethodCallConfig implements DataFlow :: StateConfigSig {
31+ class FlowState = DataFlow :: FlowLabel ;
3232
33- override predicate isSource ( DataFlow:: Node source , DataFlow:: FlowLabel label ) {
33+ predicate isSource ( DataFlow:: Node source , DataFlow:: FlowLabel label ) {
3434 source .( Source ) .getFlowLabel ( ) = label
3535 }
3636
37- override predicate isSink ( DataFlow:: Node sink , DataFlow:: FlowLabel label ) {
37+ predicate isSink ( DataFlow:: Node sink , DataFlow:: FlowLabel label ) {
3838 sink .( Sink ) .getFlowLabel ( ) = label
3939 }
4040
41- override predicate isLabeledBarrier ( DataFlow:: Node node , DataFlow:: FlowLabel label ) {
42- super .isLabeledBarrier ( node , label )
43- or
41+ predicate isBarrier ( DataFlow:: Node node , DataFlow:: FlowLabel label ) {
4442 node .( Sanitizer ) .getFlowLabel ( ) = label
43+ or
44+ TaintTracking:: defaultSanitizer ( node ) and
45+ label .isTaint ( )
46+ or
47+ node = DataFlow:: MakeLabeledBarrierGuard< BarrierGuard > :: getABarrierNode ( label )
4548 }
4649
47- override predicate isSanitizerGuard ( TaintTracking:: SanitizerGuardNode guard ) {
48- guard instanceof NumberGuard or
49- guard instanceof FunctionCheck
50+ predicate isBarrier ( DataFlow:: Node node ) {
51+ node = DataFlow:: MakeBarrierGuard< BarrierGuard > :: getABarrierNode ( )
5052 }
5153
52- override predicate isAdditionalFlowStep (
53- DataFlow:: Node src , DataFlow:: Node dst , DataFlow:: FlowLabel srclabel ,
54+ predicate isAdditionalFlowStep (
55+ DataFlow:: Node src , DataFlow:: FlowLabel srclabel , DataFlow:: Node dst ,
5456 DataFlow:: FlowLabel dstlabel
5557 ) {
5658 exists ( DataFlow:: PropRead read |
@@ -74,5 +76,48 @@ class Configuration extends TaintTracking::Configuration {
7476 ) and
7577 srclabel .isTaint ( ) and
7678 dstlabel instanceof MaybeNonFunction
79+ or
80+ srclabel .isTaint ( ) and
81+ TaintTracking:: defaultTaintStep ( src , dst ) and
82+ srclabel = dstlabel
83+ }
84+ }
85+
86+ /**
87+ * Taint-tracking for reasoning about unvalidated dynamic method calls.
88+ */
89+ module UnvalidatedDynamicMethodCallFlow =
90+ DataFlow:: GlobalWithState< UnvalidatedDynamicMethodCallConfig > ;
91+
92+ /**
93+ * DEPRECATED. Use the `UnvalidatedDynamicMethodCallFlow` module instead.
94+ */
95+ deprecated class Configuration extends TaintTracking:: Configuration {
96+ Configuration ( ) { this = "UnvalidatedDynamicMethodCall" }
97+
98+ override predicate isSource ( DataFlow:: Node source , DataFlow:: FlowLabel label ) {
99+ source .( Source ) .getFlowLabel ( ) = label
100+ }
101+
102+ override predicate isSink ( DataFlow:: Node sink , DataFlow:: FlowLabel label ) {
103+ sink .( Sink ) .getFlowLabel ( ) = label
104+ }
105+
106+ override predicate isLabeledBarrier ( DataFlow:: Node node , DataFlow:: FlowLabel label ) {
107+ super .isLabeledBarrier ( node , label )
108+ or
109+ node .( Sanitizer ) .getFlowLabel ( ) = label
110+ }
111+
112+ override predicate isSanitizerGuard ( TaintTracking:: SanitizerGuardNode guard ) {
113+ guard instanceof NumberGuard or
114+ guard instanceof FunctionCheck
115+ }
116+
117+ override predicate isAdditionalFlowStep (
118+ DataFlow:: Node src , DataFlow:: Node dst , DataFlow:: FlowLabel srclabel ,
119+ DataFlow:: FlowLabel dstlabel
120+ ) {
121+ UnvalidatedDynamicMethodCallConfig:: isAdditionalFlowStep ( src , srclabel , dst , dstlabel )
77122 }
78123}
0 commit comments