-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security/Http] Hash Persistent RememberMe token #35960
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
[Security/Http] Hash Persistent RememberMe token #35960
Conversation
You need random data in the hash (nonce) to make the secret unknowable. |
SHA256 seems good enough as per #27910 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't miss adding some tests :)
src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Security/Http/RememberMe/PersistentTokenBasedRememberMeServices.php
Outdated
Show resolved
Hide resolved
...fony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
Outdated
Show resolved
Hide resolved
I've updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Security CHANGELOG needs to be updated.
Thank you @guillbdx. |
The purpose of this PR is to enhance the Remember Me persistent token feature: instead of storing cleared token value in DB, the values will be hashed.
To make sure that existing remember me cookies will keep being valid after this change, we prefix the new token values with 'hash_'. In case the token value doesn't match this prefix, we keep validating it the old way.