mirror of
https://github.com/github/codeql.git
synced 2026-04-23 07:45:17 +02:00
Ruby: Fix StringSubstitutionCall charpred
Some missing parens meant this class targeted way more things than intended.
This commit is contained in:
@@ -19,9 +19,11 @@ class StringSubstitutionCall extends DataFlow::CallNode {
|
||||
StringSubstitutionCall() {
|
||||
this.getMethodName() = ["sub", "sub!", "gsub", "gsub!"] and
|
||||
exists(this.getReceiver()) and
|
||||
this.getNumberOfArguments() = 2
|
||||
or
|
||||
this.getNumberOfArguments() = 1 and exists(this.getBlock())
|
||||
(
|
||||
this.getNumberOfArguments() = 2
|
||||
or
|
||||
this.getNumberOfArguments() = 1 and exists(this.getBlock())
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -268,3 +268,8 @@ def bad_path_sanitizer(p1, p2)
|
||||
p1.sub! "/../", "" # NOT OK
|
||||
p2.sub "/../", "" # NOT OK
|
||||
end
|
||||
|
||||
def each_line_sanitizer(p1)
|
||||
p1.each_line("\n") do |l| # OK - does no sanitization
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user