@@ -10,7 +10,7 @@ private import RegexFlowModels
1010private import semmle.code.java.security.SecurityTests
1111
1212private class ExploitableStringLiteral extends StringLiteral {
13- ExploitableStringLiteral ( ) { this .getValue ( ) .matches ( [ "%+%" , "%*%" ] ) }
13+ ExploitableStringLiteral ( ) { this .getValue ( ) .matches ( [ "%+%" , "%*%" , "%{%}%" ] ) }
1414}
1515
1616private class RegexCompileFlowConf extends DataFlow2:: Configuration {
@@ -32,6 +32,9 @@ private class RegexCompileFlowConf extends DataFlow2::Configuration {
3232/**
3333 * Holds if `s` is used as a regex, with the mode `mode` (if known).
3434 * If regex mode is not known, `mode` will be `"None"`.
35+ *
36+ * As an optimisation, only regexes containing an infinite repitition quatifier (`+`, `*`, or `{x,}`)
37+ * and therefore may be relevant for ReDoS queries are considered.
3538 */
3639predicate usedAsRegex ( StringLiteral s , string mode , boolean match_full_string ) {
3740 exists ( DataFlow:: Node sink |
@@ -224,6 +227,9 @@ private class RegexMatchFlowConf extends DataFlow2::Configuration {
224227
225228/**
226229 * Holds if the string literal `regex` is a regular expression that is matched against the expression `str`.
230+ *
231+ * As an optimisation, only regexes containing an infinite repitition quatifier (`+`, `*`, or `{x,}`)
232+ * and therefore may be relevant for ReDoS queries are considered.
227233 */
228234predicate regexMatchedAgainst ( StringLiteral regex , Expr str ) {
229235 exists (
0 commit comments