Ruby: Refactor and slightly expand ActionDispatch modelling
#13259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The modelling for request accesses in
ActionController.qllseemed more related toActionDispatch, so I wanted to move this intoActionDispatch.qll.ActionDispatch.qllitself was kind of large, so I ended up splitting this into multiple files -Mime.qllandRouting.qllfor what was already present inActionDispatch.qll, andRequest.qllfor the parts moved fromActionController.qll.I expanded request modelling a tiny bit by considering direct instantiations of
ActionDispatch::Requestas being request instances. This is mostly driven by cases like https://github.com/rails/rails/blob/070d4afacd3e9721b7e3a4634e4d026b5fa2c32c/actionpack/lib/action_dispatch/middleware/actionable_exceptions.rb#L16-L21 - I expect it's an uncommon pattern.I've aimed to avoid changing the API in any substantial way, e.g.
ActionDispatch::Routingwas public before, but theRequestmodule was not. The component files ofActionDispatchare in aninternaldirectory to try to avoid these being used directly.