Skip to content

Commit 3641b28

Browse files
author
Benjamin Muskalla
committed
Convert javax-json to InlineFlowTest
1 parent a6b4720 commit 3641b28

File tree

1 file changed

+2
-50
lines changed
  • java/ql/test/library-tests/frameworks/javax-json

1 file changed

+2
-50
lines changed
Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,4 @@
11
import java
2-
import semmle.code.java.dataflow.DataFlow
3-
import semmle.code.java.dataflow.TaintTracking
4-
import TestUtilities.InlineExpectationsTest
2+
import TestUtilities.InlineFlowTest
53

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

0 commit comments

Comments
 (0)