File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
lib/semmle/python/security/dataflow Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ module PolynomialReDoS {
35
35
/** Gets the regex that is being executed by this node. */
36
36
abstract RegExpTerm getRegExp ( ) ;
37
37
38
+ /** Gets a term within the regexp that may perform polynomial back-tracking. */
39
+ final PolynomialBackTrackingTerm getABacktrackingTerm ( ) {
40
+ result .getRootTerm ( ) = this .getRegExp ( )
41
+ }
42
+
38
43
/**
39
44
* Gets the node to highlight in the alert message.
40
45
*/
Original file line number Diff line number Diff line change @@ -18,11 +18,12 @@ private module PolynomialReDoSConfig implements DataFlow::ConfigSig {
18
18
19
19
predicate isBarrier ( DataFlow:: Node node ) { node instanceof Sanitizer }
20
20
21
- predicate observeDiffInformedIncrementalMode ( ) {
22
- // TODO(diff-informed): Manually verify if config can be diff-informed.
23
- // ql/src/Security/CWE-730/PolynomialReDoS.ql:31: Column 1 selects sink.getHighlight
24
- // ql/src/Security/CWE-730/PolynomialReDoS.ql:33: Column 5 does not select a source or sink originating from the flow call on line 24
25
- none ( )
21
+ predicate observeDiffInformedIncrementalMode ( ) { any ( ) }
22
+
23
+ Location getASelectedSinkLocation ( DataFlow:: Node sink ) {
24
+ result = sink .( Sink ) .getHighlight ( ) .getLocation ( )
25
+ or
26
+ result = sink .( Sink ) .getABacktrackingTerm ( ) .getLocation ( )
26
27
}
27
28
}
28
29
Original file line number Diff line number Diff line change 23
23
where
24
24
PolynomialReDoSFlow:: flowPath ( source , sink ) and
25
25
sinkNode = sink .getNode ( ) and
26
- regexp . getRootTerm ( ) = sinkNode .getRegExp ( )
26
+ regexp = sinkNode .getABacktrackingTerm ( )
27
27
// not (
28
28
// source.getNode().(Source).getKind() = "url" and
29
29
// regexp.isAtEndLine()
You can’t perform that action at this time.
0 commit comments