Skip to content

Use IsCsrfTokenValid Attribute - #1564

Open
seb-jean wants to merge 1 commit into
symfony:mainfrom
seb-jean:iscsrftokenvalid-attribute
Open

Use IsCsrfTokenValid Attribute#1564
seb-jean wants to merge 1 commit into
symfony:mainfrom
seb-jean:iscsrftokenvalid-attribute

Conversation

@seb-jean

Copy link
Copy Markdown
Contributor

This will allow the use of IsCsrfTokenValid Attribute but we lose the redirection when the csrk token is not valid.
What do you think?

@94noni

94noni commented Feb 26, 2025

Copy link
Copy Markdown
Contributor

not commenting for the PR changes but cant this redirect feature be implemented upstream ?
for ex a code with:

#[Route('/entity/{id}')]
public function show(Entity $entity): Response

returns a 404, can this attribute propose a way to return a specific response status code ?

@javiereguiluz

Copy link
Copy Markdown
Member

I was going to merge this ... but I tested it again and now I'm not sure.

With the new code, when there's a CSRF token exception the user is redirected to the public blog index instead of the blog admin page. It's pretty confusing 😐

@seb-jean

Copy link
Copy Markdown
Contributor Author

Yes, indeed. We have no control over this behavior.

@stof

stof commented May 19, 2025

Copy link
Copy Markdown
Member

There is a discussion about it in symfony/symfony#57343

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.

4 participants