mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Make ActionDispatch::Route into a private class ActionDispatch::RouteImpl, defining a new class Route which exposes the necessary public API from RouteImpl. Also rename getHTTPMethod to getHttpMethod.
27 lines
793 B
Plaintext
27 lines
793 B
Plaintext
private import ruby
|
|
private import codeql.ruby.frameworks.ActionDispatch
|
|
private import codeql.ruby.frameworks.ActionController
|
|
|
|
query predicate actionDispatchRoutes(
|
|
ActionDispatch::Route r, string method, string path, string controller, string action
|
|
) {
|
|
r.getHttpMethod() = method and
|
|
r.getPath() = path and
|
|
r.getController() = controller and
|
|
r.getAction() = action
|
|
}
|
|
|
|
query predicate actionDispatchControllerMethods(
|
|
ActionDispatch::Route r, ActionControllerActionMethod m
|
|
) {
|
|
m.getARoute() = r
|
|
}
|
|
|
|
query predicate underscore(string input, string output) {
|
|
output = ActionDispatch::underscore(input) and
|
|
input in [
|
|
"Foo", "FooBar", "Foo::Bar", "FooBar::Baz", "Foo::Bar::Baz", "Foo::Bar::BazQuux", "invalid",
|
|
"HTTPServerRequest", "LotsOfCapitalLetters"
|
|
]
|
|
}
|