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

CSRF token cookie could be improved #2877

Open
matrixbot opened this issue Sep 10, 2024 · 0 comments
Open

CSRF token cookie could be improved #2877

matrixbot opened this issue Sep 10, 2024 · 0 comments

Comments

@matrixbot
Copy link
Collaborator

This issue was originally created by @reivilibre at matrix-org/matrix-authentication-service#2877.

I was just looking at the code for the CSRF token cookie and suspect it could be improved.

https://github.com/matrix-org/matrix-authentication-service/blob/7c67630c951ecf2fc8e19a8184ca51ba2476a03c/crates/axum-utils/src/csrf.rs#L134

  • cookie name should start with __Host- to prevent, in modern browsers that support this, some classes of cookie fixation attacks.
  • making it HTTP-only and 'Secure' seems good as defence in depth

https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies

I think localhost is considered 'Secure' so this shouldn't affect local development much, but there is a minor possibility this would need to be configurable.

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

No branches or pull requests

1 participant