Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Best practice for the csrf token and secret (signed? httponly?) #211

Closed
mrkchang opened this issue Apr 5, 2020 · 1 comment
Closed

Best practice for the csrf token and secret (signed? httponly?) #211

mrkchang opened this issue Apr 5, 2020 · 1 comment
Labels

Comments

@mrkchang
Copy link

mrkchang commented Apr 5, 2020

For the CSRF secret, what the best practice for 1) signed and 2) httponly?
For the CSRF token, what the best practice for 1) signed and 2) httponly?
Why doesn't the module automatically parse the request cookies instead of the the developer having to manually add the token in the header?

@dougwilson
Copy link
Contributor

For the CSRF secret, what the best practice for 1) signed and 2) httponly?

Whatever the most secure you can set for your environment. If you can also enable samesite and secure in addition, even better. Enable as much as possible for your environment.

For the CSRF token, what the best practice for 1) signed and 2) httponly?
Why doesn't the module automatically parse the request cookies instead of the the developer having to manually add the token in the header?

The token itself cannot be inside a cookie, as the purpose of csrf is to solve the issue that web browsers automatically include cookies in requests. The token needs to be specifically included for csrf protection to work as it is designed. That is not specific to this module. You can read more on owasp 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants