Skip to content

Commit 38e65ee

Browse files
committed
Refactor apache-http test
1 parent f745642 commit 38e65ee

File tree

1 file changed

+7
-11
lines changed
  • java/ql/test/library-tests/frameworks/apache-http

1 file changed

+7
-11
lines changed

java/ql/test/library-tests/frameworks/apache-http/flow.ql

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,14 @@ import semmle.code.java.security.XSS
55
import semmle.code.java.security.UrlRedirect
66
import TestUtilities.InlineFlowTest
77

8-
class EnableLegacy extends EnableLegacyConfiguration {
9-
EnableLegacy() { exists(this) }
10-
}
11-
12-
class Conf extends TaintTracking::Configuration {
13-
Conf() { this = "qltest:frameworks:apache-http" }
14-
15-
override predicate isSource(DataFlow::Node n) {
8+
module Config implements DataFlow::ConfigSig {
9+
predicate isSource(DataFlow::Node n) {
1610
n.asExpr().(MethodAccess).getMethod().hasName("taint")
1711
or
1812
n instanceof RemoteFlowSource
1913
}
2014

21-
override predicate isSink(DataFlow::Node n) {
15+
predicate isSink(DataFlow::Node n) {
2216
exists(MethodAccess ma | ma.getMethod().hasName("sink") | n.asExpr() = ma.getAnArgument())
2317
or
2418
n instanceof XssSink
@@ -27,8 +21,10 @@ class Conf extends TaintTracking::Configuration {
2721
}
2822
}
2923

24+
module Flow = TaintTracking::Global<Config>;
25+
3026
class HasFlowTest extends InlineFlowTest {
31-
override DataFlow::Configuration getValueFlowConfig() { none() }
27+
override predicate hasValueFlow(DataFlow::Node src, DataFlow::Node sink) { none() }
3228

33-
override DataFlow::Configuration getTaintFlowConfig() { result = any(Conf c) }
29+
override predicate hasTaintFlow(DataFlow::Node src, DataFlow::Node sink) { Flow::flow(src, sink) }
3430
}

0 commit comments

Comments
 (0)