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
202202 }
203203}
204204
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+
205220/**
206221 * A method in an `ActionController` class that is accessible from within a
207222 * Rails view as a helper method. For instance, in:
@@ -222,11 +237,9 @@ class ActionControllerHelperMethod extends Method {
222237 private ActionControllerControllerClass controllerClass ;
223238
224239 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 )
230243 )
231244 }
232245
You can’t perform that action at this time.
0 commit comments