File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
java/ql/lib/semmle/code/java/security Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,20 @@ class SimpleTypeSanitizer extends DataFlow::Node {
4343predicate regexpMatchGuardChecks ( Guard guard , Expr e , boolean branch ) {
4444 exists ( RegexMatch rm | not rm instanceof Annotation |
4545 guard = rm and
46- e = rm .getString ( )
46+ (
47+ e = rm .getString ( )
48+ or
49+ // Special case for MatcherMatchesCall. Consider the following code:
50+ //
51+ // Matcher matcher = Pattern.compile(regexp).matcher(taintedInput);
52+ // if (matcher.matches()) {
53+ // sink(matcher.group(1));
54+ // }
55+ //
56+ // Even though the string is `taintedInput`, we also want to sanitize
57+ // `matcher` as it can be used to get substrings of `taintedInput`.
58+ e = rm .( MatcherMatchesCall ) .getQualifier ( )
59+ )
4760 ) and
4861 branch = true
4962}
You can’t perform that action at this time.
0 commit comments