1+ import javascript
12import DataFlowConfig
23
3- query predicate dataFlow ( DataFlow:: Node src , DataFlow:: Node snk ) {
4- exists ( TestDataFlowConfiguration tttc | tttc .hasFlow ( src , snk ) )
5- }
4+ query predicate dataFlow ( DataFlow:: Node src , DataFlow:: Node snk ) { TestFlow:: flow ( src , snk ) }
65
76class Parity extends DataFlow:: FlowLabel {
87 Parity ( ) { this = "even" or this = "odd" }
98
109 Parity flip ( ) { result != this }
1110}
1211
13- class FLowLabelConfig extends DataFlow:: Configuration {
14- FLowLabelConfig ( ) { this = "FLowLabelConfig" }
12+ module FlowLabelConfig implements DataFlow:: StateConfigSig {
13+ class FlowState = DataFlow :: FlowLabel ;
1514
16- override predicate isSource ( DataFlow:: Node nd , DataFlow:: FlowLabel lbl ) {
15+ predicate isSource ( DataFlow:: Node nd , DataFlow:: FlowLabel lbl ) {
1716 nd .( DataFlow:: CallNode ) .getCalleeName ( ) = "source" and
1817 lbl = "even"
1918 }
2019
21- override predicate isSink ( DataFlow:: Node nd , DataFlow:: FlowLabel lbl ) {
20+ predicate isSink ( DataFlow:: Node nd , DataFlow:: FlowLabel lbl ) {
2221 nd = any ( DataFlow:: CallNode c | c .getCalleeName ( ) = "sink" ) .getAnArgument ( ) and
2322 lbl = "even"
2423 }
2524
26- override predicate isAdditionalFlowStep (
27- DataFlow:: Node pred , DataFlow:: Node succ , DataFlow:: FlowLabel predLabel ,
25+ predicate isAdditionalFlowStep (
26+ DataFlow:: Node pred , DataFlow:: FlowLabel predLabel , DataFlow:: Node succ ,
2827 DataFlow:: FlowLabel succLabel
2928 ) {
3029 exists ( DataFlow:: CallNode c | c = succ |
@@ -35,28 +34,28 @@ class FLowLabelConfig extends DataFlow::Configuration {
3534 }
3635}
3736
38- query predicate flowLabels ( DataFlow:: PathNode source , DataFlow:: PathNode sink ) {
39- exists ( FLowLabelConfig cfg | cfg .hasFlowPath ( source , sink ) )
40- }
37+ module FlowLabelFlow = DataFlow:: GlobalWithState< FlowLabelConfig > ;
4138
42- class TestTaintTrackingConfiguration extends TaintTracking:: Configuration {
43- TestTaintTrackingConfiguration ( ) { this = "TestTaintTrackingConfiguration" }
39+ query predicate flowLabels ( FlowLabelFlow:: PathNode source , FlowLabelFlow:: PathNode sink ) {
40+ FlowLabelFlow:: flowPath ( source , sink )
41+ }
4442
45- override predicate isSource ( DataFlow:: Node src ) {
43+ module TaintConfig implements DataFlow:: ConfigSig {
44+ predicate isSource ( DataFlow:: Node src ) {
4645 exists ( VariableDeclarator vd |
4746 vd .getBindingPattern ( ) .( VarDecl ) .getName ( ) .matches ( "%source%" ) and
4847 src .asExpr ( ) = vd .getInit ( )
4948 )
5049 }
5150
52- override predicate isSink ( DataFlow:: Node snk ) {
51+ predicate isSink ( DataFlow:: Node snk ) {
5352 exists ( VariableDeclarator vd |
5453 vd .getBindingPattern ( ) .( VarDecl ) .getName ( ) .matches ( "%sink%" ) and
5554 snk .asExpr ( ) = vd .getInit ( )
5655 )
5756 }
5857
59- override predicate isSanitizer ( DataFlow:: Node node ) {
58+ predicate isBarrier ( DataFlow:: Node node ) {
6059 exists ( Function f |
6160 f .getName ( ) .matches ( "%noReturnTracking%" ) and
6261 node = f .getAReturnedExpr ( ) .flow ( )
@@ -66,14 +65,12 @@ class TestTaintTrackingConfiguration extends TaintTracking::Configuration {
6665 }
6766}
6867
69- query predicate taintTracking ( DataFlow:: Node src , DataFlow:: Node snk ) {
70- exists ( TestTaintTrackingConfiguration tttc | tttc .hasFlow ( src , snk ) )
71- }
68+ module TaintFlow = TaintTracking:: Global< TaintConfig > ;
7269
73- class GermanFlowConfig extends DataFlow:: Configuration {
74- GermanFlowConfig ( ) { this = "GermanFlowConfig" }
70+ query predicate taintTracking ( DataFlow:: Node src , DataFlow:: Node snk ) { TaintFlow:: flow ( src , snk ) }
7571
76- override predicate isSource ( DataFlow:: Node src ) {
72+ module GermanConfig implements DataFlow:: ConfigSig {
73+ predicate isSource ( DataFlow:: Node src ) {
7774 exists ( VariableDeclarator vd |
7875 vd .getBindingPattern ( ) .( VarDecl ) .getName ( ) .matches ( "%source%" ) and
7976 src .asExpr ( ) = vd .getInit ( )
@@ -82,7 +79,7 @@ class GermanFlowConfig extends DataFlow::Configuration {
8279 src .asExpr ( ) = any ( Variable v | v .getName ( ) = "quelle" ) .getAnAssignedExpr ( )
8380 }
8481
85- override predicate isSink ( DataFlow:: Node snk ) {
82+ predicate isSink ( DataFlow:: Node snk ) {
8683 exists ( VariableDeclarator vd |
8784 vd .getBindingPattern ( ) .( VarDecl ) .getName ( ) .matches ( "%sink%" ) and
8885 snk .asExpr ( ) = vd .getInit ( )
@@ -91,7 +88,7 @@ class GermanFlowConfig extends DataFlow::Configuration {
9188 snk .asExpr ( ) = any ( Variable v | v .getName ( ) = "abfluss" ) .getAnAssignedExpr ( )
9289 }
9390
94- override predicate isBarrier ( DataFlow:: Node node ) {
91+ predicate isBarrier ( DataFlow:: Node node ) {
9592 exists ( Function f |
9693 f .getName ( ) .matches ( "%noReturnTracking%" ) and
9794 node = f .getAReturnedExpr ( ) .flow ( )
@@ -101,6 +98,6 @@ class GermanFlowConfig extends DataFlow::Configuration {
10198 }
10299}
103100
104- query predicate germanFlow ( DataFlow :: Node src , DataFlow:: Node snk ) {
105- exists ( GermanFlowConfig tttc | tttc . hasFlow ( src , snk ) )
106- }
101+ module GermanFlow = DataFlow:: Global < GermanConfig > ;
102+
103+ query predicate germanFlow ( DataFlow :: Node src , DataFlow :: Node snk ) { GermanFlow :: flow ( src , snk ) }
0 commit comments