Refactor RabbitMQ test

This commit is contained in:
Ed Minnix
2023-04-13 21:55:01 -04:00
parent 2579852e90
commit e0e5bb131b

View File

@@ -3,22 +3,18 @@ import semmle.code.java.dataflow.TaintTracking
import semmle.code.java.dataflow.FlowSources
import TestUtilities.InlineFlowTest
class EnableLegacy extends EnableLegacyConfiguration {
EnableLegacy() { exists(this) }
}
module Config implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource }
class Conf extends TaintTracking::Configuration {
Conf() { this = "qltest:frameworks:rabbitmq" }
override predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource }
override predicate isSink(DataFlow::Node node) {
predicate isSink(DataFlow::Node node) {
exists(MethodAccess ma | ma.getMethod().hasName("sink") | node.asExpr() = ma.getAnArgument())
}
}
class HasFlowTest extends InlineFlowTest {
override DataFlow::Configuration getValueFlowConfig() { none() }
module Flow = TaintTracking::Global<Config>;
override DataFlow::Configuration getTaintFlowConfig() { result = any(Conf c) }
class HasFlowTest extends InlineFlowTest {
override predicate hasValueFlow(DataFlow::Node src, DataFlow::Node sink) { none() }
override predicate hasTaintFlow(DataFlow::Node src, DataFlow::Node sink) { Flow::flow(src, sink) }
}