@@ -11,32 +11,29 @@ DataFlow::CallNode getAYamlCall() {
11
11
isYamlFunction ( result .getACalleeIncludingExternals ( ) .asFunction ( ) )
12
12
}
13
13
14
- class TaintTransitsFunctionConfig extends TaintTracking:: Configuration {
15
- TaintTransitsFunctionConfig ( ) { this = "TaintTransitsFunctionConfig" }
16
-
17
- predicate isSourceSinkPair ( DataFlow:: Node inNode , DataFlow:: Node outNode ) {
18
- exists ( DataFlow:: CallNode cn | cn = getAYamlCall ( ) |
19
- inNode = [ cn .getAnArgument ( ) , cn .getReceiver ( ) ] and
20
- (
21
- outNode .( DataFlow:: PostUpdateNode ) .getPreUpdateNode ( ) =
22
- [ cn .getAnArgument ( ) , cn .getReceiver ( ) ]
23
- or
24
- outNode = cn .getAResult ( )
25
- )
14
+ predicate isSourceSinkPair ( DataFlow:: Node inNode , DataFlow:: Node outNode ) {
15
+ exists ( DataFlow:: CallNode cn | cn = getAYamlCall ( ) |
16
+ inNode = [ cn .getAnArgument ( ) , cn .getReceiver ( ) ] and
17
+ (
18
+ outNode .( DataFlow:: PostUpdateNode ) .getPreUpdateNode ( ) = [ cn .getAnArgument ( ) , cn .getReceiver ( ) ]
19
+ or
20
+ outNode = cn .getAResult ( )
26
21
)
27
- }
22
+ )
23
+ }
28
24
29
- override predicate isSource ( DataFlow:: Node n ) { this .isSourceSinkPair ( n , _) }
25
+ module TaintTransitsFunctionConfig implements DataFlow:: ConfigSig {
26
+ predicate isSource ( DataFlow:: Node n ) { isSourceSinkPair ( n , _) }
30
27
31
- override predicate isSink ( DataFlow:: Node n ) { this . isSourceSinkPair ( _, n ) }
28
+ predicate isSink ( DataFlow:: Node n ) { isSourceSinkPair ( _, n ) }
32
29
}
33
30
34
- class TaintFunctionModelTest extends InlineExpectationsTest {
35
- TaintFunctionModelTest ( ) { this = "TaintFunctionModelTest" }
31
+ module TaintTransitsFunctionFlow = TaintTracking:: Global< TaintTransitsFunctionConfig > ;
36
32
37
- override string getARelevantTag ( ) { result = "ttfnmodelstep" }
33
+ module TaintFunctionModelTest implements TestSig {
34
+ string getARelevantTag ( ) { result = "ttfnmodelstep" }
38
35
39
- override predicate hasActualResult ( Location location , string element , string tag , string value ) {
36
+ predicate hasActualResult ( Location location , string element , string tag , string value ) {
40
37
tag = "ttfnmodelstep" and
41
38
(
42
39
exists ( TaintTracking:: FunctionModel model , DataFlow:: CallNode call | call = model .getACall ( ) |
@@ -46,9 +43,9 @@ class TaintFunctionModelTest extends InlineExpectationsTest {
46
43
value = "\"" + model .getAnInputNode ( call ) + " -> " + model .getAnOutputNode ( call ) + "\""
47
44
)
48
45
or
49
- exists ( TaintTransitsFunctionConfig config , DataFlow:: Node arg , DataFlow:: Node output |
50
- config . hasFlow ( arg , output ) and
51
- config . isSourceSinkPair ( arg , output ) and
46
+ exists ( DataFlow:: Node arg , DataFlow:: Node output |
47
+ TaintTransitsFunctionFlow :: flow ( arg , output ) and
48
+ isSourceSinkPair ( arg , output ) and
52
49
arg .hasLocationInfo ( location .getFile ( ) .getAbsolutePath ( ) , location .getStartLine ( ) ,
53
50
location .getStartColumn ( ) , location .getEndLine ( ) , location .getEndColumn ( ) ) and
54
51
element = arg .toString ( ) and
@@ -58,12 +55,10 @@ class TaintFunctionModelTest extends InlineExpectationsTest {
58
55
}
59
56
}
60
57
61
- class MarshalerTest extends InlineExpectationsTest {
62
- MarshalerTest ( ) { this = "MarshalerTest" }
63
-
64
- override string getARelevantTag ( ) { result = "marshaler" }
58
+ module MarshalerTest implements TestSig {
59
+ string getARelevantTag ( ) { result = "marshaler" }
65
60
66
- override predicate hasActualResult ( Location location , string element , string tag , string value ) {
61
+ predicate hasActualResult ( Location location , string element , string tag , string value ) {
67
62
tag = "marshaler" and
68
63
exists ( MarshalingFunction m , DataFlow:: CallNode call | call = m .getACall ( ) |
69
64
call .hasLocationInfo ( location .getFile ( ) .getAbsolutePath ( ) , location .getStartLine ( ) ,
@@ -76,12 +71,10 @@ class MarshalerTest extends InlineExpectationsTest {
76
71
}
77
72
}
78
73
79
- class UnmarshalerTest extends InlineExpectationsTest {
80
- UnmarshalerTest ( ) { this = "UnmarshalerTest " }
74
+ module UnmarshalerTest implements TestSig {
75
+ string getARelevantTag ( ) { result = "unmarshaler " }
81
76
82
- override string getARelevantTag ( ) { result = "unmarshaler" }
83
-
84
- override predicate hasActualResult ( Location location , string element , string tag , string value ) {
77
+ predicate hasActualResult ( Location location , string element , string tag , string value ) {
85
78
tag = "unmarshaler" and
86
79
exists ( UnmarshalingFunction m , DataFlow:: CallNode call | call = m .getACall ( ) |
87
80
call .hasLocationInfo ( location .getFile ( ) .getAbsolutePath ( ) , location .getStartLine ( ) ,
@@ -93,3 +86,5 @@ class UnmarshalerTest extends InlineExpectationsTest {
93
86
)
94
87
}
95
88
}
89
+
90
+ import MakeTest< MergeTests3< TaintFunctionModelTest , MarshalerTest , UnmarshalerTest > >
0 commit comments