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

Make CSRF failures less confusing #2390

Closed
simonw opened this issue Aug 14, 2024 · 4 comments
Closed

Make CSRF failures less confusing #2390

simonw opened this issue Aug 14, 2024 · 4 comments

Comments

@simonw
Copy link
Owner

simonw commented Aug 14, 2024

A CSRF failure currently returns a confusing error message:

form-urlencoded POST field did not match cookie

Would be good if that at least linked to relevant docs https://docs.datasette.io/en/stable/internals.html#csrf-protection - since these errors are most likely during development.

On Discord here: https://discord.com/channels/823971286308356157/823971286941302908/1273347775165235391

Relevant:

@simonw
Copy link
Owner Author

simonw commented Aug 15, 2024

I released asgi-csrf 0.10 with a new feature to enable this: https://github.com/simonw/asgi-csrf/releases/tag/0.10

@simonw
Copy link
Owner Author

simonw commented Aug 15, 2024

New design:

csrf-error

@simonw simonw closed this as completed in 06d4ffb Aug 15, 2024
@simonw simonw mentioned this issue Aug 15, 2024
3 tasks
@simonw
Copy link
Owner Author

simonw commented Aug 15, 2024

Ooops... looks like this is served without text/html as the content-type!

CleanShot 2024-08-15 at 08 46 37@2x

@simonw simonw reopened this Aug 15, 2024
@simonw
Copy link
Owner Author

simonw commented Aug 15, 2024

Fixed:

csrf-test

@simonw simonw closed this as completed Aug 15, 2024
simonw added a commit that referenced this issue Aug 16, 2024
simonw added a commit that referenced this issue Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant