8000 [Security] fix #41891 Save hashed tokenValue in RememberMe cookie · symfony/symfony@9ccaa93 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ccaa93

Browse files
committed
[Security] fix #41891 Save hashed tokenValue in RememberMe cookie
1 parent 7cdd665 commit 9ccaa93

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Symfony/Component/Security/Http/RememberMe/PersistentRememberMeHandler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,12 @@ public function processRememberMe(RememberMeDetails $rememberMeDetails, UserInte
8989
// if a token was regenerated less than a minute ago, there is no need to regenerate it
9090
// if multiple concurrent requests reauthenticate a user we do not want to update the token several times
9191
if ($persistentToken->getLastUsed()->getTimestamp() + 60 < time()) {
92-
$tokenValue = base64_encode(random_bytes(64));
93-
$tokenValueHash = $this->generateHash($tokenValue);
92+
$tokenValue = $this->generateHash(base64_encode(random_bytes(64)));
9493
$tokenLastUsed = new \DateTime();
9594
if ($this->tokenVerifier) {
96-
$this->tokenVerifier->updateExistingToken($persistentToken, $tokenValueHash, $tokenLastUsed);
95+
$this->tokenVerifier->updateExistingToken($persistentToken, $tokenValue, $tokenLastUsed);
9796
}
98-
$this->tokenProvider->updateToken($series, $tokenValueHash, $tokenLastUsed);
97+
$this->tokenProvider->updateToken($series, $tokenValue, $tokenLastUsed);
9998
}
10099

101100
$this->createCookie($rememberMeDetails->withValue($series.':'.$tokenValue));

0 commit comments

Comments
 (0)
0