mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Convert regex injection barrier to MaD
This commit is contained in:
committed by
Anders Schack-Mulligen
parent
44295e4c7d
commit
87f58fe51a
@@ -12,6 +12,11 @@ extensions:
|
|||||||
- ["java.util.regex", "Pattern", False, "split", "(CharSequence)", "", "Argument[this]", "regex-use[0]", "manual"]
|
- ["java.util.regex", "Pattern", False, "split", "(CharSequence)", "", "Argument[this]", "regex-use[0]", "manual"]
|
||||||
- ["java.util.regex", "Pattern", False, "split", "(CharSequence,int)", "", "Argument[this]", "regex-use[0]", "manual"]
|
- ["java.util.regex", "Pattern", False, "split", "(CharSequence,int)", "", "Argument[this]", "regex-use[0]", "manual"]
|
||||||
- ["java.util.regex", "Pattern", False, "splitAsStream", "(CharSequence)", "", "Argument[this]", "regex-use[0]", "manual"]
|
- ["java.util.regex", "Pattern", False, "splitAsStream", "(CharSequence)", "", "Argument[this]", "regex-use[0]", "manual"]
|
||||||
|
- addsTo:
|
||||||
|
pack: codeql/java-all
|
||||||
|
extensible: barrierModel
|
||||||
|
data:
|
||||||
|
- ["java.util.regex", "Pattern", False, "quote", "(String)", "", "ReturnValue", "regex-use", "manual"]
|
||||||
- addsTo:
|
- addsTo:
|
||||||
pack: codeql/java-all
|
pack: codeql/java-all
|
||||||
extensible: summaryModel
|
extensible: summaryModel
|
||||||
|
|||||||
@@ -21,17 +21,8 @@ private class DefaultRegexInjectionSink extends RegexInjectionSink {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private class DefaultRegexInjectionSanitizer extends RegexInjectionSanitizer {
|
||||||
* A call to the `Pattern.quote` method, which gives metacharacters or escape sequences
|
DefaultRegexInjectionSanitizer() { barrierNode(this, "regex-use") }
|
||||||
* no special meaning.
|
|
||||||
*/
|
|
||||||
private class PatternQuoteCall extends RegexInjectionSanitizer {
|
|
||||||
PatternQuoteCall() {
|
|
||||||
exists(MethodCall ma, Method m | m = ma.getMethod() |
|
|
||||||
ma.getArgument(0) = this.asExpr() and
|
|
||||||
m instanceof PatternQuoteMethod
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user