mirror of
https://github.com/github/codeql.git
synced 2025-12-23 04:06:37 +01:00
Refactor jms test
This commit is contained in:
@@ -2,18 +2,18 @@ import java
|
|||||||
import semmle.code.java.dataflow.FlowSources
|
import semmle.code.java.dataflow.FlowSources
|
||||||
import TestUtilities.InlineExpectationsTest
|
import TestUtilities.InlineExpectationsTest
|
||||||
|
|
||||||
class TestConfig extends TaintTracking::Configuration {
|
module TestConfig implements DataFlow::ConfigSig {
|
||||||
TestConfig() { this = "TestConfig" }
|
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
|
||||||
|
|
||||||
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
|
predicate isSink(DataFlow::Node sink) {
|
||||||
|
|
||||||
override predicate isSink(DataFlow::Node sink) {
|
|
||||||
exists(MethodAccess call |
|
exists(MethodAccess call |
|
||||||
call.getMethod().hasName("sink") and call.getArgument(0) = sink.asExpr()
|
call.getMethod().hasName("sink") and call.getArgument(0) = sink.asExpr()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module TestFlow = TaintTracking::Global<TestConfig>;
|
||||||
|
|
||||||
class JmsFlowTest extends InlineExpectationsTest {
|
class JmsFlowTest extends InlineExpectationsTest {
|
||||||
JmsFlowTest() { this = "JmsFlowTest" }
|
JmsFlowTest() { this = "JmsFlowTest" }
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ class JmsFlowTest extends InlineExpectationsTest {
|
|||||||
|
|
||||||
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
||||||
tag = "tainted" and
|
tag = "tainted" and
|
||||||
exists(DataFlow::PathNode sink, TestConfig conf | conf.hasFlowPath(_, sink) |
|
exists(TestFlow::PathNode sink | TestFlow::flowPath(_, sink) |
|
||||||
location = sink.getNode().getLocation() and element = sink.getNode().toString() and value = ""
|
location = sink.getNode().getLocation() and element = sink.getNode().toString() and value = ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user