@@ -78,26 +78,40 @@ predicate isExponentialRegex(StringLiteral s) {
78
78
}
79
79
80
80
/**
81
+ * DEPRECATED: Use `ExponentialRegexDataflow` instead.
82
+ *
81
83
* A data flow configuration for tracking exponential worst case time regular expression string
82
84
* literals to the pattern argument of a regex.
83
85
*/
84
- class ExponentialRegexDataflow extends DataFlow2:: Configuration {
86
+ deprecated class ExponentialRegexDataflow extends DataFlow2:: Configuration {
85
87
ExponentialRegexDataflow ( ) { this = "ExponentialRegex" }
86
88
87
89
override predicate isSource ( DataFlow:: Node s ) { isExponentialRegex ( s .asExpr ( ) ) }
88
90
89
91
override predicate isSink ( DataFlow:: Node s ) { s .asExpr ( ) = any ( RegexOperation c ) .getPattern ( ) }
90
92
}
91
93
94
+ /**
95
+ * A data flow configuration for tracking exponential worst case time regular expression string
96
+ * literals to the pattern argument of a regex.
97
+ */
98
+ private module ExponentialRegexDataFlowConfig implements DataFlow:: ConfigSig {
99
+ predicate isSource ( DataFlow:: Node s ) { isExponentialRegex ( s .asExpr ( ) ) }
100
+
101
+ predicate isSink ( DataFlow:: Node s ) { s .asExpr ( ) = any ( RegexOperation c ) .getPattern ( ) }
102
+ }
103
+
104
+ module ExponentialRegexDataFlow = DataFlow:: Global< ExponentialRegexDataFlowConfig > ;
105
+
92
106
/**
93
107
* An expression passed as the `input` to a call to a `Regex` method, where the regex appears to
94
108
* have exponential behavior.
95
109
*/
96
110
class ExponentialRegexSink extends DataFlow:: ExprNode , Sink {
97
111
ExponentialRegexSink ( ) {
98
- exists ( ExponentialRegexDataflow regexDataflow , RegexOperation regexOperation |
112
+ exists ( RegexOperation regexOperation |
99
113
// Exponential regex flows to the pattern argument
100
- regexDataflow . hasFlow ( _, DataFlow:: exprNode ( regexOperation .getPattern ( ) ) )
114
+ ExponentialRegexDataFlow :: flow ( _, DataFlow:: exprNode ( regexOperation .getPattern ( ) ) )
101
115
|
102
116
// This is used as an input for this pattern
103
117
this .getExpr ( ) = regexOperation .getInput ( ) and
0 commit comments