File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
ruby/ql/lib/codeql/ruby/frameworks Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -202,6 +202,21 @@ class ActionControllerRedirectResponse extends HTTP::Server::HttpRedirectRespons
202
202
}
203
203
}
204
204
205
+ pragma [ nomagic]
206
+ private predicate isActionControllerMethod ( Method m , string name , ActionControllerControllerClass c ) {
207
+ m .getName ( ) = name and
208
+ m .getEnclosingModule ( ) = c
209
+ }
210
+
211
+ pragma [ nomagic]
212
+ private predicate actionControllerHasHelperMethodCall ( ActionControllerControllerClass c , string name ) {
213
+ exists ( MethodCall mc |
214
+ mc .getMethodName ( ) = "helper_method" and
215
+ mc .getAnArgument ( ) .getConstantValue ( ) .isStringOrSymbol ( name ) and
216
+ mc .getEnclosingModule ( ) = c
217
+ )
218
+ }
219
+
205
220
/**
206
221
* A method in an `ActionController` class that is accessible from within a
207
222
* Rails view as a helper method. For instance, in:
@@ -222,11 +237,9 @@ class ActionControllerHelperMethod extends Method {
222
237
private ActionControllerControllerClass controllerClass ;
223
238
224
239
ActionControllerHelperMethod ( ) {
225
- this .getEnclosingModule ( ) = controllerClass and
226
- exists ( MethodCall helperMethodMarker |
227
- helperMethodMarker .getMethodName ( ) = "helper_method" and
228
- helperMethodMarker .getAnArgument ( ) .getConstantValue ( ) .isStringOrSymbol ( this .getName ( ) ) and
229
- helperMethodMarker .getEnclosingModule ( ) = controllerClass
240
+ exists ( string name |
241
+ isActionControllerMethod ( this , name , controllerClass ) and
242
+ actionControllerHasHelperMethodCall ( controllerClass , name )
230
243
)
231
244
}
232
245
You can’t perform that action at this time.
0 commit comments