mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Ruby: handle Regexp.quote wherever we handle Regexp.escape
This commit is contained in:
@@ -335,12 +335,12 @@ class ModuleEvalCallCodeExecution extends CodeExecution::Range, DataFlow::CallNo
|
||||
override DataFlow::Node getCode() { result = this.getArgument(0) }
|
||||
}
|
||||
|
||||
/** Flow summary for `Regexp.escape`. */
|
||||
/** Flow summary for `Regexp.escape` and its alias, `Regexp.quote`. */
|
||||
class RegexpEscapeSummary extends SummarizedCallable {
|
||||
RegexpEscapeSummary() { this = "Regexp.escape" }
|
||||
|
||||
override MethodCall getACall() {
|
||||
result = API::getTopLevelMember("Regexp").getAMethodCall("escape").asExpr().getExpr()
|
||||
result = API::getTopLevelMember("Regexp").getAMethodCall(["escape", "quote"]).asExpr().getExpr()
|
||||
}
|
||||
|
||||
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
|
||||
|
||||
@@ -70,9 +70,12 @@ module RegExpInjection {
|
||||
StringConstArrayInclusionCall { }
|
||||
|
||||
/**
|
||||
* A call to `Regexp.escape`, considered as a sanitizer.
|
||||
* A call to `Regexp.escape` (or its alias, `Regexp.quote`), considered as a
|
||||
* sanitizer.
|
||||
*/
|
||||
class RegexpEscapeSanitization extends Sanitizer {
|
||||
RegexpEscapeSanitization() { this = API::getTopLevelMember("Regexp").getAMethodCall("escape") }
|
||||
RegexpEscapeSanitization() {
|
||||
this = API::getTopLevelMember("Regexp").getAMethodCall(["escape", "quote"])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user