@@ -32,8 +32,12 @@ private class LengthRestrictedMethod extends Method {
32
32
}
33
33
}
34
34
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 {
37
41
PolynomialRedosConfig ( ) { this = "PolynomialRedosConfig" }
38
42
39
43
override predicate isSource ( DataFlow:: Node src ) { src instanceof RemoteFlowSource }
@@ -47,11 +51,34 @@ class PolynomialRedosConfig extends TaintTracking::Configuration {
47
51
}
48
52
}
49
53
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 (
52
60
DataFlow:: PathNode source , DataFlow:: PathNode sink ,
53
61
SuperlinearBackTracking:: PolynomialBackTrackingTerm regexp
54
62
) {
55
63
any ( PolynomialRedosConfig config ) .hasFlowPath ( source , sink ) and
56
64
regexp .getRootTerm ( ) = sink .getNode ( ) .( PolynomialRedosSink ) .getRegExp ( )
57
65
}
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