Defect #44784
openAuthenticity token is written to server logs when opening the context menu
Description
The context menu is loaded with an Ajax request that serializes the form surrounding the list, including the authenticity_token field. The request is sent with GET, so the token ends up in the query string:
As a result, the token is written to the access logs of the web server and any reverse proxy. It is also written to the Rails log, because authenticity_token is not listed in config.filter_parameters. This is not easy to exploit: an attacker would need access to the logs, and would also have to trick the user into submitting a forged request while the user's session is still valid. Still, a CSRF token should not be stored in logs.
The attached patch sends the request with POST, so the token goes in the request body instead. All context menu routes already accept POST, so nothing needs to change on the server side.
The patch also adds dataType: 'html' to the request. Without it, jQuery decides how to handle the response based on its Content-Type header, and it would evaluate a response served as JavaScript. The context menu always expects an HTML fragment, so the patch declares that type.
Files
Updated by Go MAEDA about 9 hours ago
- Target version set to Candidate for next minor release