@@ -15,19 +15,17 @@ import NosqlInjectionCustomizations::NosqlInjection
1515 * A taint-tracking configuration for reasoning about SQL-injection vulnerabilities.
1616 */
1717module NosqlInjectionConfig implements DataFlow:: StateConfigSig {
18- class FlowState = DataFlow :: FlowLabel ;
18+ import semmle.javascript.security.CommonFlowState
1919
20- predicate isSource ( DataFlow:: Node source , DataFlow :: FlowLabel state ) {
20+ predicate isSource ( DataFlow:: Node source , FlowState state ) {
2121 source instanceof Source and state .isTaint ( )
2222 or
23- TaintedObject:: isSource ( source , state )
23+ source instanceof TaintedObject:: Source and state . isTaintedObject ( )
2424 }
2525
26- predicate isSink ( DataFlow:: Node sink , DataFlow:: FlowLabel state ) {
27- sink .( Sink ) .getAFlowLabel ( ) = state
28- }
26+ predicate isSink ( DataFlow:: Node sink , FlowState state ) { sink .( Sink ) .getAFlowState ( ) = state }
2927
30- predicate isBarrier ( DataFlow:: Node node , DataFlow :: FlowLabel state ) {
28+ predicate isBarrier ( DataFlow:: Node node , FlowState state ) {
3129 node instanceof Sanitizer and state .isTaint ( )
3230 or
3331 TaintTracking:: defaultSanitizer ( node ) and state .isTaint ( )
@@ -36,14 +34,13 @@ module NosqlInjectionConfig implements DataFlow::StateConfigSig {
3634 }
3735
3836 predicate isAdditionalFlowStep (
39- DataFlow:: Node node1 , DataFlow:: FlowLabel state1 , DataFlow:: Node node2 ,
40- DataFlow:: FlowLabel state2
37+ DataFlow:: Node node1 , FlowState state1 , DataFlow:: Node node2 , FlowState state2
4138 ) {
42- TaintedObject:: step ( node1 , node2 , state1 , state2 )
39+ TaintedObject:: isAdditionalFlowStep ( node1 , state1 , node2 , state2 )
4340 or
4441 // additional flow step to track taint through NoSQL query objects
45- state1 = TaintedObject :: label ( ) and
46- state2 = TaintedObject :: label ( ) and
42+ state1 . isTaintedObject ( ) and
43+ state2 . isTaintedObject ( ) and
4744 exists ( NoSql:: Query query , DataFlow:: SourceNode queryObj |
4845 queryObj .flowsTo ( query ) and
4946 queryObj .flowsTo ( node2 ) and
@@ -90,6 +87,7 @@ deprecated class Configuration extends TaintTracking::Configuration {
9087 DataFlow:: Node node1 , DataFlow:: Node node2 , DataFlow:: FlowLabel state1 ,
9188 DataFlow:: FlowLabel state2
9289 ) {
93- NosqlInjectionConfig:: isAdditionalFlowStep ( node1 , state1 , node2 , state2 )
90+ NosqlInjectionConfig:: isAdditionalFlowStep ( node1 , FlowState:: fromFlowLabel ( state1 ) , node2 ,
91+ FlowState:: fromFlowLabel ( state2 ) )
9492 }
9593}
0 commit comments