Fix timing attack on signin

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-05-25 23:04:44 -07:00
parent 1dc9f5f0cd
commit 6eb30c7b79
2 changed files with 12 additions and 1 deletions

View File

@@ -505,7 +505,7 @@ func (s AuthService) CheckCredentials(
// Perform a password comparison even when the identity does not exist to mitigate timing attacks
// and prevent revealing account existence.
if identity.ID == gid.Nil {
_, _ = s.hp.ComparePasswordAndHash([]byte(password+"qwertyuiop1234567890"), []byte("qwertyuiop1234567890"))
_, _ = s.hp.ComparePasswordAndHash([]byte(password), s.dummyHash)
return NewInvalidCredentialsError("invalid email or password")
}