We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Matcher.matches()
1 parent ca4c988 commit f6e034eCopy full SHA for f6e034e
1 file changed
java/ql/lib/semmle/code/java/security/Sanitizers.qll
@@ -43,7 +43,20 @@ class SimpleTypeSanitizer extends DataFlow::Node {
43
predicate regexpMatchGuardChecks(Guard guard, Expr e, boolean branch) {
44
exists(RegexMatch rm | not rm instanceof Annotation |
45
guard = rm and
46
- e = rm.getString()
+ (
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
+ )
60
) and
61
branch = true
62
}
0 commit comments