Skip to content

Conversation

@xabbuh
Copy link
Member

@xabbuh xabbuh commented Oct 16, 2025

Q A
Branch? 7.3
Bug fix? no
New feature? no
Deprecations? no
Issues
License MIT

I suggest to revert #62037 as I doubt that the proposed fix is the solution for the problem described. First, we are now always reading data from the request body as mentioned in #62037 (comment).

Then, the issue the PR tries to fix is described as follows:

When using the logout_path (or logout_url) twig function with stateless csrf, the generator creates a link with an invalid CSRF token parameter (/logout?_csrf_token=csrf-token), which then causes an error during logout (Invalid CSRF token), since the LogoutListener reads the token from the query parameter first.

IMO what this really means is that the shouldn't be a URL with an invalid token being generated in the first place instead of doing guess work in the listener about which one to pick.

I have added a test to prove that the listener is able to properly validate CSRF tokens as part of the request body as well as tokens provided as URL parameters.

@nicolas-grekas
Copy link
Member

Can you expand on why this shouldn't be the correct fix?
Having the token in the query-string when a logout is meant to use POST on purpose looks like it's defeating the POST preference.
What's the issue with the merged approach?

@xabbuh xabbuh closed this Oct 21, 2025
@xabbuh xabbuh deleted the pr-62037 branch October 21, 2025 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants