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

Support CSRF protection token of Symfony's form component #2132

Merged
merged 9 commits into from
Jan 26, 2024

Conversation

stollr
Copy link
Contributor

@stollr stollr commented Sep 12, 2023

This PR adds support of the CSRF protection token which is created by the Symfony form component if the csrf_protection option is enabled.

As soon as this option is enabled a corresponding property will be added to the schema.

This PR addresses #2120.

There already was another PR (#411) some years ago, but it wasn't merged. I'd be happy if this could be accepted.

@stollr
Copy link
Contributor Author

stollr commented Dec 22, 2023

@GuilhemN I'd be really happy if you could have a look at this addition.

@stollr stollr force-pushed the form_csrf_support branch from d3a4bfc to 467ef2d Compare January 9, 2024 08:46
@DjordyKoert
Copy link
Collaborator

I would also like to see a functional test for this https://github.com/nelmio/NelmioApiDocBundle/tree/master/Tests/Functional/Form 😄

@stollr stollr force-pushed the form_csrf_support branch from f97e7c4 to 6eaf3fe Compare January 9, 2024 14:38
@stollr
Copy link
Contributor Author

stollr commented Jan 9, 2024

@DjordyKoert I have added a functional test, now.

@DjordyKoert
Copy link
Collaborator

Thank you, could you please also write a test which shows the behaviour when using configureOptions() https://symfony.com/doc/current/security/csrf.html#csrf-protection-in-symfony-forms 😄

@stollr
Copy link
Contributor Author

stollr commented Jan 10, 2024

@DjordyKoert I have added some edge case handling and more tests. What do you think now?

@DjordyKoert DjordyKoert merged commit b96c263 into nelmio:master Jan 26, 2024
12 checks passed
@DjordyKoert
Copy link
Collaborator

Thank you @stollr!

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

Successfully merging this pull request may close these issues.

2 participants