@@ -32,8 +32,12 @@ private class LengthRestrictedMethod extends Method {
3232 }
3333}
3434
35- /** A configuration for Polynomial ReDoS queries. */
36- class PolynomialRedosConfig extends TaintTracking:: Configuration {
35+ /**
36+ * DEPRECATED: Use `PolynomialRedosFlow` instead.
37+ *
38+ * A configuration for Polynomial ReDoS queries.
39+ */
40+ deprecated class PolynomialRedosConfig extends TaintTracking:: Configuration {
3741 PolynomialRedosConfig ( ) { this = "PolynomialRedosConfig" }
3842
3943 override predicate isSource ( DataFlow:: Node src ) { src instanceof RemoteFlowSource }
@@ -47,11 +51,34 @@ class PolynomialRedosConfig extends TaintTracking::Configuration {
4751 }
4852}
4953
50- /** Holds if there is flow from `source` to `sink` that is matched against the regexp term `regexp` that is vulnerable to Polynomial ReDoS. */
51- predicate hasPolynomialReDoSResult (
54+ /**
55+ * DEPRECATED: Use `PolynomialRedosFlow` instead.
56+ *
57+ * Holds if there is flow from `source` to `sink` that is matched against the regexp term `regexp` that is vulnerable to Polynomial ReDoS.
58+ */
59+ deprecated predicate hasPolynomialReDoSResult (
5260 DataFlow:: PathNode source , DataFlow:: PathNode sink ,
5361 SuperlinearBackTracking:: PolynomialBackTrackingTerm regexp
5462) {
5563 any ( PolynomialRedosConfig config ) .hasFlowPath ( source , sink ) and
5664 regexp .getRootTerm ( ) = sink .getNode ( ) .( PolynomialRedosSink ) .getRegExp ( )
5765}
66+
67+ /** A configuration for Polynomial ReDoS queries. */
68+ private module PolynomialRedosConfig implements DataFlow:: ConfigSig {
69+ predicate isSource ( DataFlow:: Node src ) { src instanceof RemoteFlowSource }
70+
71+ predicate isSink ( DataFlow:: Node sink ) {
72+ exists ( SuperlinearBackTracking:: PolynomialBackTrackingTerm regexp |
73+ regexp .getRootTerm ( ) = sink .( PolynomialRedosSink ) .getRegExp ( )
74+ )
75+ }
76+
77+ predicate isBarrier ( DataFlow:: Node node ) {
78+ node .getType ( ) instanceof PrimitiveType or
79+ node .getType ( ) instanceof BoxedType or
80+ node .asExpr ( ) .( MethodAccess ) .getMethod ( ) instanceof LengthRestrictedMethod
81+ }
82+ }
83+
84+ module PolynomialRedosFlow = TaintTracking:: Make< PolynomialRedosConfig > ;
0 commit comments