File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,17 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
139139 {
140140 return (string) $this->email;
141141 }
142+
143+ /**
144+ * @see UserInterface
145+ *
146+ * Required until Symfony 8.0, where eraseCredentials() will be removed from the interface.
147+ * No-op since plainPassword is cleared manually in the password processor.
148+ */
149+ public function eraseCredentials(): void
150+ {
151+ // Intentionally left blank
152+ }
142153}
143154```
144155
@@ -251,6 +262,9 @@ final readonly class UserPasswordHasher implements ProcessorInterface
251262 );
252263 $data->setPassword($hashedPassword);
253264
265+ // To avoid leaving sensitive data like the plain password in memory or logs, we manually clear it after hashing.
266+ $data->setPlainPassword(null);
267+
254268 return $this->processor->process($data, $operation, $uriVariables, $context);
255269 }
256270}
You can’t perform that action at this time.
0 commit comments