Skip to content

Commit 0221719

Browse files
committed
Ruby: fix some ql for ql alerts
1 parent bea110b commit 0221719

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,10 @@ private class LocalAssignsHashSyntheticGlobal extends SummaryComponent::Syntheti
312312

313313
/** A summary for `render` calls linked to some specific ERB file. */
314314
private class RenderLocalsSummary extends SummarizedCallable {
315-
private string id;
316315
private LocalAssignsHashSyntheticGlobal glob;
317316

318317
RenderLocalsSummary() {
319-
this = "rails_render_locals()" + id and
320-
glob.getId() = id
318+
this = "rails_render_locals()" + glob.getId()
321319
}
322320

323321
override Rails::RenderCall getACall() { result.getTemplateFile() = glob.getErbFile() }
@@ -331,16 +329,14 @@ private class RenderLocalsSummary extends SummarizedCallable {
331329

332330
/** A summary for calls to `local_assigns` in a view to access a `render` call `locals` hash. */
333331
private class AccessLocalsSummary extends SummarizedCallable {
334-
private string id;
335332
private LocalAssignsHashSyntheticGlobal glob;
336333

337334
AccessLocalsSummary() {
338-
this = "rails_local_assigns()" + id and
339-
glob.getId() = id
335+
this = "rails_local_assigns()" + glob.getId()
340336
}
341337

342338
override MethodCall getACall() {
343-
id = getErbFileIdentifier(result.getLocation().getFile()) and
339+
glob.getId() = getErbFileIdentifier(result.getLocation().getFile()) and
344340
result.getMethodName() = "local_assigns"
345341
}
346342

@@ -365,13 +361,11 @@ private predicate renderHasLocalsKey(Rails::RenderCall c, string key) {
365361
}
366362

367363
private class AccessLocalsKeySummary extends SummarizedCallable {
368-
private string id;
369364
private LocalAssignsHashSyntheticGlobal glob;
370365
private string methodName;
371366

372367
AccessLocalsKeySummary() {
373-
this = "rails_locals_key()" + id and
374-
id = glob.getId() + "#" + methodName and
368+
this = "rails_locals_key()" + glob.getId() + "#" + methodName and
375369
methodName = getAMethodNameFromErbFile(glob.getErbFile())
376370
// TODO: this would cut down massively on impossible flow steps, but fails due to non-monotonic recusrion problems
377371
// and

0 commit comments

Comments
 (0)