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

Return 400 Bad request when csrf token is invalid #610

Merged
merged 1 commit into from Jun 5, 2018

Conversation

adamjez
Copy link
Contributor

@adamjez adamjez commented Jun 5, 2018

4xx status code should be returned when CSRF token is invalid.
Currently we are returning 500 internal error.

I chose status code 400 as ASP.NET team https://github.com/aspnet/Antiforgery

Copy link
Member

@exyi exyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, this should cause a "bad request" response. Maybe it would be even nicer to show some more info than just "invalid token". What about a simple page that would explain that it's probably caused by new keys on the server (for devs/admins) and that it's not a big deal and you can just clear cookies (with a button to do that, for users of the broken apps)

@adamjez
Copy link
Contributor Author

adamjez commented Jun 5, 2018

@exyi I've created separate issue for the html page. I'm merging it.

@adamjez adamjez merged commit 89890df into master Jun 5, 2018
@quigamdev quigamdev deleted the fix/invalid-csrf-token-return-400 branch September 18, 2019 15:03
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.

None yet

2 participants