11import java
2- import semmle.code.java.dataflow.DataFlow
3- import semmle.code.java.dataflow.ExternalFlow
4- import semmle.code.java.dataflow.TaintTracking
5- import TestUtilities.InlineExpectationsTest
2+ import TestUtilities.InlineFlowTest
63
74class SummaryModelTest extends SummaryModelCsv {
85 override predicate row ( string row ) {
@@ -14,50 +11,4 @@ class SummaryModelTest extends SummaryModelCsv {
1411 }
1512}
1613
17- class ValueFlowConf extends DataFlow:: Configuration {
18- ValueFlowConf ( ) { this = "qltest:valueFlowConf" }
19-
20- override predicate isSource ( DataFlow:: Node n ) {
21- n .asExpr ( ) .( MethodAccess ) .getMethod ( ) .hasName ( "source" )
22- }
23-
24- override predicate isSink ( DataFlow:: Node n ) {
25- n .asExpr ( ) .( Argument ) .getCall ( ) .getCallee ( ) .hasName ( "sink" )
26- }
27- }
28-
29- class TaintFlowConf extends TaintTracking:: Configuration {
30- TaintFlowConf ( ) { this = "qltest:taintFlowConf" }
31-
32- override predicate isSource ( DataFlow:: Node n ) {
33- n .asExpr ( ) .( MethodAccess ) .getMethod ( ) .hasName ( "source" )
34- }
35-
36- override predicate isSink ( DataFlow:: Node n ) {
37- n .asExpr ( ) .( Argument ) .getCall ( ) .getCallee ( ) .hasName ( "sink" )
38- }
39- }
40-
41- class HasFlowTest extends InlineExpectationsTest {
42- HasFlowTest ( ) { this = "HasFlowTest" }
43-
44- override string getARelevantTag ( ) { result = [ "hasValueFlow" , "hasTaintFlow" ] }
45-
46- override predicate hasActualResult ( Location location , string element , string tag , string value ) {
47- tag = "hasValueFlow" and
48- exists ( DataFlow:: Node src , DataFlow:: Node sink , ValueFlowConf conf | conf .hasFlow ( src , sink ) |
49- sink .getLocation ( ) = location and
50- element = sink .toString ( ) and
51- value = ""
52- )
53- or
54- tag = "hasTaintFlow" and
55- exists ( DataFlow:: Node src , DataFlow:: Node sink , TaintFlowConf conf |
56- conf .hasFlow ( src , sink ) and not any ( ValueFlowConf c ) .hasFlow ( src , sink )
57- |
58- sink .getLocation ( ) = location and
59- element = sink .toString ( ) and
60- value = ""
61- )
62- }
63- }
14+ class HasFlowTest extends InlineFlowTest { }
0 commit comments