diff --git a/java/ql/lib/semmle/code/java/regex/RegexFlowConfigs.qll b/java/ql/lib/semmle/code/java/regex/RegexFlowConfigs.qll index 6a934bdd578..01da32a39c6 100644 --- a/java/ql/lib/semmle/code/java/regex/RegexFlowConfigs.qll +++ b/java/ql/lib/semmle/code/java/regex/RegexFlowConfigs.qll @@ -170,12 +170,15 @@ private module RegexFlow = DataFlow::Global; * As an optimisation, only regexes containing an infinite repitition quatifier (`+`, `*`, or `{x,}`) * and therefore may be relevant for ReDoS queries are considered. */ -predicate usedAsRegex(StringLiteral regex, string mode, boolean match_full_string) { +predicate usedAsRegexG(StringLiteral regex, string mode, boolean match_full_string) { RegexFlow::flow(DataFlow::exprNode(regex), _) and - mode = "None" and // TODO: proper mode detection + mode = "None" and // TODO: proper mode detection (if matchesFullString(regex) then match_full_string = true else match_full_string = false) } +overlay[local] +predicate usedAsRegex(StringLiteral regex, string mode, boolean match_full_string) = forceLocal(usedAsRegexG/3)(regex, mode, match_full_string) + /** * Holds if `regex` is used as a regular expression that is matched against a full string, * as though it was implicitly surrounded by ^ and $. diff --git a/java/ql/lib/semmle/code/java/regex/RegexTreeView.qll b/java/ql/lib/semmle/code/java/regex/RegexTreeView.qll index 0fe4b47ec48..a2c12e2898d 100644 --- a/java/ql/lib/semmle/code/java/regex/RegexTreeView.qll +++ b/java/ql/lib/semmle/code/java/regex/RegexTreeView.qll @@ -1,5 +1,5 @@ /** Provides a class hierarchy corresponding to a parse tree of regular expressions. */ -overlay[local?] +overlay[local] module; private import semmle.code.java.regex.regex as RE // importing under a namescape to avoid naming conflict for `Top`. diff --git a/java/ql/lib/semmle/code/java/regex/regex.qll b/java/ql/lib/semmle/code/java/regex/regex.qll index 13f39869966..5aee736e571 100644 --- a/java/ql/lib/semmle/code/java/regex/regex.qll +++ b/java/ql/lib/semmle/code/java/regex/regex.qll @@ -936,6 +936,7 @@ abstract class RegexString extends StringLiteral { } /** A string literal used as a regular expression */ +overlay[local] class Regex extends RegexString { boolean matches_full_string;