Skip to content

Commit 2b1c70c

Browse files
committed
Java: Diff-informed PolynomialReDoS.ql
This and other queries would also benefit from making `RegexFlow` diff-informed. That will come later.
1 parent 5bebae9 commit 2b1c70c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

java/ql/lib/semmle/code/java/security/regexp/PolynomialReDoSQuery.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ module PolynomialRedosConfig implements DataFlow::ConfigSig {
4747
node instanceof SimpleTypeSanitizer or
4848
node.asExpr().(MethodCall).getMethod() instanceof LengthRestrictedMethod
4949
}
50+
51+
predicate observeDiffInformedIncrementalMode() { any() }
52+
53+
Location getASelectedSinkLocation(DataFlow::Node sink) {
54+
exists(SuperlinearBackTracking::PolynomialBackTrackingTerm regexp |
55+
regexp.getRootTerm() = sink.(PolynomialRedosSink).getRegExp()
56+
|
57+
result = sink.getLocation()
58+
or
59+
result = regexp.getLocation()
60+
)
61+
}
5062
}
5163

5264
module PolynomialRedosFlow = TaintTracking::Global<PolynomialRedosConfig>;

0 commit comments

Comments
 (0)