Skip to content

Commit 3e1808d

Browse files
Apply suggestions from code review
Co-authored-by: Alex Ford <[email protected]>
1 parent cd49175 commit 3e1808d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ private import codeql.ruby.Concepts
99
/**
1010
* Provides templating for embedding Ruby code into text files, allowing dynamic content generation in web applications.
1111
*/
12-
module ERB {
12+
module Erb {
1313
/**
1414
* Flow summary for `ERB.new`. This method wraps a template string, compiling it.
1515
*/
1616
private class TemplateSummary extends SummarizedCallable {
1717
TemplateSummary() { this = "ERB.new" }
1818

1919
override MethodCall getACall() {
20-
result = API::getTopLevelMember("ERB").getAMethodCall("new").asExpr().getExpr()
20+
result = any(ErbTemplateNewCall c).asExpr().getExpr()
2121
}
2222

2323
override predicate propagatesFlowExt(string input, string output, boolean preservesValue) {
@@ -26,18 +26,18 @@ module ERB {
2626
}
2727

2828
/** A call to `ERB.new`, considered as a template construction. */
29-
private class ERBTemplateNewCall extends TemplateConstruction::Range, DataFlow::CallNode {
30-
ERBTemplateNewCall() { this = API::getTopLevelMember("ERB").getAMethodCall("new") }
29+
private class ErbTemplateNewCall extends TemplateConstruction::Range, DataFlow::CallNode {
30+
ERBTemplateNewCall() { this = API::getTopLevelMember("ERB").getAnInstantiation() }
3131

3232
override DataFlow::Node getTemplate() { result = this.getArgument(0) }
3333
}
3434

3535
/** A call to `ERB.new(foo).result(binding)`, considered as a template rendering. */
36-
private class ERBTemplateRendering extends TemplateRendering::Range, DataFlow::CallNode {
37-
DataFlow::Node template;
36+
private class ErbTemplateRendering extends TemplateRendering::Range, DataFlow::CallNode {
37+
private DataFlow::Node template;
3838

39-
ERBTemplateRendering() {
40-
exists(ERBTemplateNewCall templateConstruction |
39+
ErbTemplateRendering() {
40+
exists(ErbTemplateNewCall templateConstruction |
4141
this = templateConstruction.getAMethodCall("result") and
4242
template = templateConstruction.getTemplate()
4343
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Slim {
1313
/** A call to `Slim::Template.new`, considered as a template construction. */
1414
private class SlimTemplateNewCall extends TemplateConstruction::Range, DataFlow::CallNode {
1515
SlimTemplateNewCall() {
16-
this = API::getTopLevelMember("Slim").getMember("Template").getAMethodCall("new")
16+
this = API::getTopLevelMember("Slim").getMember("Template").getAnInstantiation()
1717
}
1818

1919
override DataFlow::Node getTemplate() {
@@ -24,7 +24,7 @@ module Slim {
2424

2525
/** A call to `Slim::Template.new{ foo }.render`, considered as a template rendering */
2626
private class SlimTemplateRendering extends TemplateRendering::Range, DataFlow::CallNode {
27-
DataFlow::Node template;
27+
private DataFlow::Node template;
2828

2929
SlimTemplateRendering() {
3030
exists(SlimTemplateNewCall templateConstruction |

ruby/ql/lib/codeql/ruby/security/TemplateInjectionCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ module TemplateInjection {
4343
* An inclusion check against an array of constant strings, considered as a
4444
* sanitizer-guard.
4545
*/
46-
class StringConstArrayInclusionCallAsSanitizer extends Sanitizer,
46+
private class StringConstArrayInclusionCallAsSanitizer extends Sanitizer,
4747
StringConstArrayInclusionCallBarrier { }
4848
}

0 commit comments

Comments
 (0)