Skip to content

Commit 14561c4

Browse files
authored
Merge pull request #14225 from hvitved/ruby/fix-bad-join
Ruby: Fix a bad join
2 parents 7304803 + c83a29c commit 14561c4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ruby/ql/lib/codeql/ruby/frameworks/Sinatra.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ module Sinatra {
179179
}
180180
}
181181

182+
bindingset[local]
183+
pragma[inline_late]
184+
private predicate isPairKey(string local) {
185+
local = any(Pair p).getKey().getConstantValue().getStringlikeValue()
186+
}
187+
182188
/**
183189
* A summary for accessing a local variable in an ERB template.
184190
* This is the second half of the modeling of the flow from the `locals`
@@ -192,7 +198,7 @@ module Sinatra {
192198
ErbLocalsAccessSummary() {
193199
this = "sinatra_erb_locals_access()" + global.getId() + "#" + local and
194200
local = any(MethodCall c | c.getLocation().getFile() = global.getErbFile()).getMethodName() and
195-
local = any(Pair p).getKey().getConstantValue().getStringlikeValue()
201+
isPairKey(local)
196202
}
197203

198204
override MethodCall getACall() {

0 commit comments

Comments
 (0)