Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LiveComponent] CSRF error when submitting a form twice #2682

Open
momocode-de opened this issue Apr 7, 2025 · 2 comments
Open

[LiveComponent] CSRF error when submitting a form twice #2682

momocode-de opened this issue Apr 7, 2025 · 2 comments
Labels

Comments

@momocode-de
Copy link

This is a follow-up ticket for #2505. The ticket was closed and then I noticed another problem, which could be reproduced there, but has not yet been solved. As the other ticket has been closed and the new problem has therefore presumably been lost, here is a new ticket.

Here is the problem again:

In my real app I have the case that I have a form for account settings. If I then change a setting and save it, it works. If I then change something again without reloading the page and want to save it, the CSRF error appears.

In another case, I have a form where you can change the password. When I fill in the fields and save them, I reset the form afterwards. If I then fill it out again and save it, the CSRF error also occurs.

It also happens if you submit the form and then the validation fails (for example, if the password requirements are not met) and you then correct the value and resubmit the form. Then I also get a CSRF error (request ends in 422 Unprocessable Content).

It also happens in the latest Symfony version. I have updated my reproducer from the old ticket to the newest version: https://github.com/momocode-de/symfony-ux-issue-2505

There is a simple form on the /home page that can be used to reproduce the problem. If you enter something in the field and then submit the form, this works. However, if you then enter something in the field again without reloading the page and submit the form again, the CSRF error occurs.

The logs then contain the following warning:

CSRF validation failed: double-submit info was used in a previous request but is now missing.

@momocode-de momocode-de added the Bug Bug Fix label Apr 7, 2025
@jdreesen
Copy link
Contributor

jdreesen commented Apr 7, 2025

Duplicate of #2601?

@momocode-de
Copy link
Author

Duplicate of #2601?

Yes maybe. I commented in the other issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants