Closed
Description
Symfony version(s) affected: 5.1.2
Description
After upgrading to Symfony 5.1.2 Remember me functionality got broken. It always replies with "This token was already used. The account is possibly compromised."
Turns out after successful login, remember me token got saved incorrectly. The onLoginSuccess
function got called and every parameter was correct in this part:
Upon persisting $this->generateHash($tokenValue),
to a database (Postgresql) however, this value was padded by spaces up till its supposed size in database: 88 characters. Later, upon comparing these values:
hash_equals
decides, that they are not.
Possible Solution
- Identify, why was this value persisted with extra spaces. I could track this issue up to doctrine-bridge.
- Remove extra spaces received from database. (If
rtrim ($persistentToken->getTokenValue())
is a suitable fix, let me know, I'll do a PR)