@@ -9,15 +9,15 @@ private import codeql.ruby.Concepts
9
9
/**
10
10
* Provides templating for embedding Ruby code into text files, allowing dynamic content generation in web applications.
11
11
*/
12
- module ERB {
12
+ module Erb {
13
13
/**
14
14
* Flow summary for `ERB.new`. This method wraps a template string, compiling it.
15
15
*/
16
16
private class TemplateSummary extends SummarizedCallable {
17
17
TemplateSummary ( ) { this = "ERB.new" }
18
18
19
19
override MethodCall getACall ( ) {
20
- result = API :: getTopLevelMember ( "ERB" ) . getAMethodCall ( "new" ) .asExpr ( ) .getExpr ( )
20
+ result = any ( ErbTemplateNewCall c ) .asExpr ( ) .getExpr ( )
21
21
}
22
22
23
23
override predicate propagatesFlowExt ( string input , string output , boolean preservesValue ) {
@@ -26,18 +26,18 @@ module ERB {
26
26
}
27
27
28
28
/** 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 ( ) }
31
31
32
32
override DataFlow:: Node getTemplate ( ) { result = this .getArgument ( 0 ) }
33
33
}
34
34
35
35
/** 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 ;
38
38
39
- ERBTemplateRendering ( ) {
40
- exists ( ERBTemplateNewCall templateConstruction |
39
+ ErbTemplateRendering ( ) {
40
+ exists ( ErbTemplateNewCall templateConstruction |
41
41
this = templateConstruction .getAMethodCall ( "result" ) and
42
42
template = templateConstruction .getTemplate ( )
43
43
)
0 commit comments