Skip to content

Commit 1ead522

Browse files
author
Benjamin Muskalla
committed
Convert guava-cache to InlineFlowTest
1 parent efd5dc9 commit 1ead522

File tree

1 file changed

+2
-51
lines changed
  • java/ql/test/library-tests/frameworks/guava/generated/cache

1 file changed

+2
-51
lines changed
Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,4 @@
11
import 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

7-
class ValueFlowConf extends DataFlow::Configuration {
8-
ValueFlowConf() { this = "qltest:valueFlowConf" }
9-
10-
override predicate isSource(DataFlow::Node n) {
11-
n.asExpr().(MethodAccess).getMethod().hasName("source")
12-
}
13-
14-
override predicate isSink(DataFlow::Node n) {
15-
n.asExpr().(Argument).getCall().getCallee().hasName("sink")
16-
}
17-
}
18-
19-
class TaintFlowConf extends TaintTracking::Configuration {
20-
TaintFlowConf() { this = "qltest:taintFlowConf" }
21-
22-
override predicate isSource(DataFlow::Node n) {
23-
n.asExpr().(MethodAccess).getMethod().hasName("source")
24-
}
25-
26-
override predicate isSink(DataFlow::Node n) {
27-
n.asExpr().(Argument).getCall().getCallee().hasName("sink")
28-
}
29-
}
30-
31-
class HasFlowTest extends InlineExpectationsTest {
32-
HasFlowTest() { this = "HasFlowTest" }
33-
34-
override string getARelevantTag() { result = ["hasValueFlow", "hasTaintFlow"] }
35-
36-
override predicate hasActualResult(Location location, string element, string tag, string value) {
37-
tag = "hasValueFlow" and
38-
exists(DataFlow::Node src, DataFlow::Node sink, ValueFlowConf conf | conf.hasFlow(src, sink) |
39-
sink.getLocation() = location and
40-
element = sink.toString() and
41-
value = ""
42-
)
43-
or
44-
tag = "hasTaintFlow" and
45-
exists(DataFlow::Node src, DataFlow::Node sink, TaintFlowConf conf |
46-
conf.hasFlow(src, sink) and not any(ValueFlowConf c).hasFlow(src, sink)
47-
|
48-
sink.getLocation() = location and
49-
element = sink.toString() and
50-
value = ""
51-
)
52-
}
53-
}
4+
class HasFlowTest extends InlineFlowTest { }

0 commit comments

Comments
 (0)