Skip to content

Commit 5ed1868

Browse files
committed
Refactor ratpack framework test
1 parent 88eb023 commit 5ed1868

File tree

1 file changed

+6
-6
lines changed
  • java/ql/test/library-tests/frameworks/ratpack

1 file changed

+6
-6
lines changed

java/ql/test/library-tests/frameworks/ratpack/flow.ql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ import semmle.code.java.dataflow.TaintTracking
33
import semmle.code.java.dataflow.FlowSources
44
import TestUtilities.InlineExpectationsTest
55

6-
class Conf extends TaintTracking::Configuration {
7-
Conf() { this = "qltest:frameworks:ratpack" }
8-
9-
override predicate isSource(DataFlow::Node n) {
6+
module Config implements DataFlow::ConfigSig {
7+
predicate isSource(DataFlow::Node n) {
108
n.asExpr().(MethodAccess).getMethod().hasName("taint")
119
or
1210
n instanceof RemoteFlowSource
1311
}
1412

15-
override predicate isSink(DataFlow::Node n) {
13+
predicate isSink(DataFlow::Node n) {
1614
exists(MethodAccess ma | ma.getMethod().hasName("sink") | n.asExpr() = ma.getAnArgument())
1715
}
1816
}
1917

18+
module Flow = TaintTracking::Global<Config>;
19+
2020
class HasFlowTest extends InlineExpectationsTest {
2121
HasFlowTest() { this = "HasFlowTest" }
2222

2323
override string getARelevantTag() { result = "hasTaintFlow" }
2424

2525
override predicate hasActualResult(Location location, string element, string tag, string value) {
2626
tag = "hasTaintFlow" and
27-
exists(DataFlow::Node sink, Conf conf | conf.hasFlowTo(sink) |
27+
exists(DataFlow::Node sink | Flow::flowTo(sink) |
2828
sink.getLocation() = location and
2929
element = sink.toString() and
3030
value = ""

0 commit comments

Comments
 (0)