Project

General

Profile

Actions

Defect #44784

open

Authenticity token is written to server logs when opening the context menu

Defect #44784: Authenticity token is written to server logs when opening the context menu

Added by Go MAEDA about 9 hours ago. Updated about 9 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Security
Resolution:
Affected version:

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:

GET /issues/context_menu?authenticity_token=...&ids%5B%5D=1

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 Actions #1

  • Target version set to Candidate for next minor release
Actions

Also available in: PDF Atom