@@ -16,13 +16,18 @@ import semmle.javascript.security.performance.PolynomialReDoS::PolynomialReDoS
1616import semmle.javascript.security.performance.SuperlinearBackTracking
1717import DataFlow:: PathGraph
1818
19- from Configuration cfg , DataFlow:: PathNode source , DataFlow:: PathNode sink , Sink sinkNode
19+ from
20+ Configuration cfg , DataFlow:: PathNode source , DataFlow:: PathNode sink , Sink sinkNode ,
21+ PolynomialBackTrackingTerm regexp
2022where
2123 cfg .hasFlowPath ( source , sink ) and
2224 sinkNode = sink .getNode ( ) and
25+ regexp = sinkNode .getRegExp ( ) and
2326 not (
2427 source .getNode ( ) .( Source ) .getKind ( ) = "url" and
25- sinkNode . getRegExp ( ) . ( PolynomialBackTrackingTerm ) .isAtEndLine ( )
28+ regexp .isAtEndLine ( )
2629 )
27- select sinkNode .getHighlight ( ) , source , sink , "This expensive $@ use depends on $@." ,
28- sinkNode .getRegExp ( ) , "regular expression" , source .getNode ( ) , source .getNode ( ) .( Source ) .describe ( )
30+ select sinkNode .getHighlight ( ) , source , sink ,
31+ "This $@ that depends on $@ may run slow on strings " + regexp .getPrefixMessage ( ) +
32+ "with many repetitions of '" + regexp .getPumpString ( ) + "'." , regexp , "regular expression" ,
33+ source .getNode ( ) , source .getNode ( ) .( Source ) .describe ( )
0 commit comments