Ruby: prevent bad join in ActionController.qll

This commit is contained in:
Harry Maclean
2022-02-08 12:10:23 +13:00
parent 61cd05cfc5
commit 3031b39dc1

View File

@@ -92,12 +92,21 @@ class ActionControllerActionMethod extends Method, HTTP::Server::RequestHandler:
* May return multiple results.
*/
ActionDispatch::Route getARoute() {
result.getController() + "_controller" =
ActionDispatch::underscore(namespaceDeclaration(controllerClass)) and
isActionControllerMethod(this, result.getAction(), controllerClass)
exists(string name |
isRoute(result, name, controllerClass) and
isActionControllerMethod(this, name, controllerClass)
)
}
}
private predicate isRoute(
ActionDispatch::Route route, string name, ActionControllerControllerClass controllerClass
) {
route.getController() + "_controller" =
ActionDispatch::underscore(namespaceDeclaration(controllerClass)) and
name = route.getAction()
}
// A method call with a `self` receiver from within a controller class
private class ActionControllerContextCall extends MethodCall {
private ActionControllerControllerClass controllerClass;