-
-
Notifications
You must be signed in to change notification settings - Fork 0
CSRF protection #2
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
Comments
CSRF is mentioned in the first Starlette issue about middleware but I don't think anyone has built it yet: encode/starlette#1 The WTForms library has CSRF protection and can be used with Starlette: https://wtforms.readthedocs.io/en/stable/csrf.html |
It looks to me like the ASGI ecosystem as a whole is missing CSRF protection. I'm going to experiment with ASGI middleware and see if I can come up with something reusable. |
https://owasp.org/www-project-cheat-sheets/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet is useful here. Looks like token-based is still the most recommended mitigation. |
This section is particularly interesting: It points out that if an attacker can hijack a subdomain (with XSS or by intercepting insecure traffic) they could force-set a cookie, which means they could control the
HTTPS-only cookies seems like a good mitigation for this one. |
Urgh, HTTPS-only cookies don't protect against this case though:
|
Using |
This is happening in https://github.com/simonw/asgi-csrf now. |
This is surprisingly missing from Starlette.
The text was updated successfully, but these errors were encountered: