mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
31 lines
975 B
Plaintext
31 lines
975 B
Plaintext
import java
|
|
import semmle.code.java.dataflow.DataFlow
|
|
import TestUtilities.InlineExpectationsTest
|
|
|
|
class Conf extends DataFlow::Configuration {
|
|
Conf() { this = "qltest:callback-dispatch" }
|
|
|
|
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 = "flow" }
|
|
|
|
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
|
tag = "flow" and
|
|
exists(DataFlow::Node src, DataFlow::Node sink, Conf conf | conf.hasFlow(src, sink) |
|
|
sink.getLocation() = location and
|
|
element = sink.toString() and
|
|
value = src.asExpr().(MethodAccess).getAnArgument().toString()
|
|
)
|
|
}
|
|
}
|