@@ -11,32 +11,29 @@ DataFlow::CallNode getAYamlCall() {
1111 isYamlFunction ( result .getACalleeIncludingExternals ( ) .asFunction ( ) )
1212}
1313
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 ( )
2621 )
27- }
22+ )
23+ }
2824
29- override predicate isSource ( DataFlow:: Node n ) { this .isSourceSinkPair ( n , _) }
25+ module TaintTransitsFunctionConfig implements DataFlow:: ConfigSig {
26+ predicate isSource ( DataFlow:: Node n ) { isSourceSinkPair ( n , _) }
3027
31- override predicate isSink ( DataFlow:: Node n ) { this . isSourceSinkPair ( _, n ) }
28+ predicate isSink ( DataFlow:: Node n ) { isSourceSinkPair ( _, n ) }
3229}
3330
34- class TaintFunctionModelTest extends InlineExpectationsTest {
35- TaintFunctionModelTest ( ) { this = "TaintFunctionModelTest" }
31+ module TaintTransitsFunctionFlow = TaintTracking:: Global< TaintTransitsFunctionConfig > ;
3632
37- override string getARelevantTag ( ) { result = "ttfnmodelstep" }
33+ module TaintFunctionModelTest implements TestSig {
34+ string getARelevantTag ( ) { result = "ttfnmodelstep" }
3835
39- override predicate hasActualResult ( Location location , string element , string tag , string value ) {
36+ predicate hasActualResult ( Location location , string element , string tag , string value ) {
4037 tag = "ttfnmodelstep" and
4138 (
4239 exists ( TaintTracking:: FunctionModel model , DataFlow:: CallNode call | call = model .getACall ( ) |
@@ -46,9 +43,9 @@ class TaintFunctionModelTest extends InlineExpectationsTest {
4643 value = "\"" + model .getAnInputNode ( call ) + " -> " + model .getAnOutputNode ( call ) + "\""
4744 )
4845 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
5249 arg .hasLocationInfo ( location .getFile ( ) .getAbsolutePath ( ) , location .getStartLine ( ) ,
5350 location .getStartColumn ( ) , location .getEndLine ( ) , location .getEndColumn ( ) ) and
5451 element = arg .toString ( ) and
@@ -58,12 +55,10 @@ class TaintFunctionModelTest extends InlineExpectationsTest {
5855 }
5956}
6057
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" }
6560
66- override predicate hasActualResult ( Location location , string element , string tag , string value ) {
61+ predicate hasActualResult ( Location location , string element , string tag , string value ) {
6762 tag = "marshaler" and
6863 exists ( MarshalingFunction m , DataFlow:: CallNode call | call = m .getACall ( ) |
6964 call .hasLocationInfo ( location .getFile ( ) .getAbsolutePath ( ) , location .getStartLine ( ) ,
@@ -76,12 +71,10 @@ class MarshalerTest extends InlineExpectationsTest {
7671 }
7772}
7873
79- class UnmarshalerTest extends InlineExpectationsTest {
80- UnmarshalerTest ( ) { this = "UnmarshalerTest " }
74+ module UnmarshalerTest implements TestSig {
75+ string getARelevantTag ( ) { result = "unmarshaler " }
8176
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 ) {
8578 tag = "unmarshaler" and
8679 exists ( UnmarshalingFunction m , DataFlow:: CallNode call | call = m .getACall ( ) |
8780 call .hasLocationInfo ( location .getFile ( ) .getAbsolutePath ( ) , location .getStartLine ( ) ,
@@ -93,3 +86,5 @@ class UnmarshalerTest extends InlineExpectationsTest {
9386 )
9487 }
9588}
89+
90+ import MakeTest< MergeTests3< TaintFunctionModelTest , MarshalerTest , UnmarshalerTest > >
0 commit comments