Refactor jms test

This commit is contained in:
Ed Minnix
2023-04-13 21:54:49 -04:00
parent 6cda285d56
commit 2579852e90

View File

@@ -2,18 +2,18 @@ import java
import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineExpectationsTest
class TestConfig extends TaintTracking::Configuration {
TestConfig() { this = "TestConfig" }
module TestConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
override predicate isSource(DataFlow::Node source) { source instanceof RemoteFlowSource }
override predicate isSink(DataFlow::Node sink) {
predicate isSink(DataFlow::Node sink) {
exists(MethodAccess call |
call.getMethod().hasName("sink") and call.getArgument(0) = sink.asExpr()
)
}
}
module TestFlow = TaintTracking::Global<TestConfig>;
class JmsFlowTest extends InlineExpectationsTest {
JmsFlowTest() { this = "JmsFlowTest" }
@@ -21,7 +21,7 @@ class JmsFlowTest extends InlineExpectationsTest {
override predicate hasActualResult(Location location, string element, string tag, string value) {
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 = ""
)
}