Skip to content

Commit eba414e

Browse files
author
Benjamin Muskalla
committed
Convert apache-collections to InlineFlowTest
1 parent 3bc70f0 commit eba414e

File tree

1 file changed

+2
-52
lines changed
  • java/ql/test/library-tests/frameworks/apache-collections

1 file changed

+2
-52
lines changed

java/ql/test/library-tests/frameworks/apache-collections/test.ql

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import java
22
import semmle.code.java.dataflow.DataFlow
33
import semmle.code.java.dataflow.ExternalFlow
44
import semmle.code.java.dataflow.TaintTracking
5-
import TestUtilities.InlineExpectationsTest
5+
import TestUtilities.InlineFlowTest
66

77
class SummaryModelTest extends SummaryModelCsv {
88
override predicate row(string row) {
@@ -17,54 +17,4 @@ class SummaryModelTest extends SummaryModelCsv {
1717
}
1818
}
1919

20-
class ValueFlowConf extends DataFlow::Configuration {
21-
ValueFlowConf() { this = "qltest:valueFlowConf" }
22-
23-
override predicate isSource(DataFlow::Node n) {
24-
n.asExpr().(MethodAccess).getMethod().hasName("source")
25-
}
26-
27-
override predicate isSink(DataFlow::Node n) {
28-
n.asExpr().(Argument).getCall().getCallee().hasName("sink")
29-
}
30-
31-
override int fieldFlowBranchLimit() { result = 1000 }
32-
}
33-
34-
class TaintFlowConf extends TaintTracking::Configuration {
35-
TaintFlowConf() { this = "qltest:taintFlowConf" }
36-
37-
override predicate isSource(DataFlow::Node n) {
38-
n.asExpr().(MethodAccess).getMethod().hasName("source")
39-
}
40-
41-
override predicate isSink(DataFlow::Node n) {
42-
n.asExpr().(Argument).getCall().getCallee().hasName("sink")
43-
}
44-
45-
override int fieldFlowBranchLimit() { result = 1000 }
46-
}
47-
48-
class HasFlowTest extends InlineExpectationsTest {
49-
HasFlowTest() { this = "HasFlowTest" }
50-
51-
override string getARelevantTag() { result = ["hasValueFlow", "hasTaintFlow"] }
52-
53-
override predicate hasActualResult(Location location, string element, string tag, string value) {
54-
tag = "hasValueFlow" and
55-
exists(DataFlow::Node src, DataFlow::Node sink, ValueFlowConf conf | conf.hasFlow(src, sink) |
56-
sink.getLocation() = location and
57-
element = sink.toString() and
58-
value = ""
59-
)
60-
or
61-
tag = "hasTaintFlow" and
62-
exists(DataFlow::Node src, DataFlow::Node sink, TaintFlowConf conf |
63-
conf.hasFlow(src, sink) and not any(ValueFlowConf c).hasFlow(src, sink)
64-
|
65-
sink.getLocation() = location and
66-
element = sink.toString() and
67-
value = ""
68-
)
69-
}
70-
}
20+
class HasFlowTest extends InlineFlowTest { }

0 commit comments

Comments
 (0)