Skip to content

Commit a46b5f9

Browse files
committed
Python: enable diff-informedness for poly redos using approximate related locations
1 parent d65da1f commit a46b5f9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

python/ql/lib/semmle/python/security/dataflow/PolynomialReDoSQuery.qll

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,13 @@ private module PolynomialReDoSConfig implements DataFlow::ConfigSig {
1818

1919
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
2020

21-
// Diff-informed incremental mode is currently disabled for this query due to
22-
// API limitations. The query exposes sink.getABacktrackingTerm() as an alert
23-
// location, but there is no way to express that information through
24-
// getASelectedSinkLocation() because there is no @location in the CodeQL
25-
// database that corresponds to a term inside a regular expression. As a
26-
// result, this query could miss alerts in diff-informed incremental mode.
27-
//
28-
// To address this problem, we need to have a version of
29-
// getASelectedSinkLocation() that uses hasLocationInfo() instead of
30-
// returning Location objects.
31-
predicate observeDiffInformedIncrementalMode() { none() }
21+
predicate observeDiffInformedIncrementalMode() { any() }
3222

3323
Location getASelectedSinkLocation(DataFlow::Node sink) {
3424
result = sink.(Sink).getHighlight().getLocation()
35-
or
25+
}
26+
27+
Location getASelectedSinkLocationApprox(DataFlow::Node sink) {
3628
result = sink.(Sink).getABacktrackingTerm().getLocation()
3729
}
3830
}

0 commit comments

Comments
 (0)