Files
codeql/java/ql/test/library-tests/dataflow/fluent-methods/flow.ql
Chris Smowton 54caf501e7 Switch fluent-methods test to use a plain DataFlow::Configuration
No taint edges are involved, so TaintTracking was unnecessary.
2021-03-01 10:16:02 +00:00

31 lines
946 B
Plaintext

import java
import semmle.code.java.dataflow.DataFlow
import TestUtilities.InlineExpectationsTest
class Conf extends DataFlow::Configuration {
Conf() { this = "qltest:dataflow:fluent-methods" }
override predicate isSource(DataFlow::Node n) {
n.asExpr().(MethodAccess).getMethod().hasName("source")
}
override predicate isSink(DataFlow::Node n) {
exists(MethodAccess ma | ma.getMethod().hasName("sink") | n.asExpr() = ma.getAnArgument())
}
}
class HasFlowTest extends InlineExpectationsTest {
HasFlowTest() { this = "HasFlowTest" }
override string getARelevantTag() { result = "hasTaintFlow" }
override predicate hasActualResult(Location location, string element, string tag, string value) {
tag = "hasTaintFlow" and
exists(DataFlow::Node src, DataFlow::Node sink, Conf conf | conf.hasFlow(src, sink) |
sink.getLocation() = location and
element = sink.toString() and
value = "y"
)
}
}