Skip to content

Commit b5cc108

Browse files
committed
Ruby: add LocalAssignsHashSyntheticGlobal#getARenderCall predicate
1 parent 0221719 commit b5cc108

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ private class LocalAssignsHashSyntheticGlobal extends SummaryComponent::Syntheti
308308

309309
/** Gets the identifier for this particular locals hash synthetic global. */
310310
string getId() { result = id }
311+
312+
/** Gets a call to render that can write to this hash. */
313+
Rails::RenderCall getARenderCall() { result.getTemplateFile() = erbFile }
311314
}
312315

313316
/** A summary for `render` calls linked to some specific ERB file. */
@@ -368,8 +371,8 @@ private class AccessLocalsKeySummary extends SummarizedCallable {
368371
this = "rails_locals_key()" + glob.getId() + "#" + methodName and
369372
methodName = getAMethodNameFromErbFile(glob.getErbFile())
370373
// TODO: this would cut down massively on impossible flow steps, but fails due to non-monotonic recusrion problems
371-
// and
372-
// renderHasLocalsKey(any(Rails::RenderCall c | c.getTemplateFile() = erbFile), methodName))
374+
// and
375+
// renderHasLocalsKey(glob.getARenderCall(), methodName)
373376
}
374377

375378
override MethodCall getACall() {

0 commit comments

Comments
 (0)