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 {
3535 /** Gets the regex that is being executed by this node. */
3636 abstract RegExpTerm getRegExp ( ) ;
3737
38+ /** Gets a term within the regexp that may perform polynomial back-tracking. */
39+ final PolynomialBackTrackingTerm getABacktrackingTerm ( ) {
40+ result .getRootTerm ( ) = this .getRegExp ( )
41+ }
42+
3843 /**
3944 * Gets the node to highlight in the alert message.
4045 */
Original file line number Diff line number Diff line change @@ -18,11 +18,12 @@ private module PolynomialReDoSConfig implements DataFlow::ConfigSig {
1818
1919 predicate isBarrier ( DataFlow:: Node node ) { node instanceof Sanitizer }
2020
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 ( )
2627 }
2728}
2829
Original file line number Diff line number Diff line change 2323where
2424 PolynomialReDoSFlow:: flowPath ( source , sink ) and
2525 sinkNode = sink .getNode ( ) and
26- regexp . getRootTerm ( ) = sinkNode .getRegExp ( )
26+ regexp = sinkNode .getABacktrackingTerm ( )
2727// not (
2828// source.getNode().(Source).getKind() = "url" and
2929// regexp.isAtEndLine()
You can’t perform that action at this time.
0 commit comments