Merge 41293d4fc592ef51f7b36f41827a3ba20c905727 into e11eaec05a5d538b113509d142e7b6f375bdf128

This commit is contained in:
Elouan Martinet 2025-08-16 11:02:34 +00:00 committed by GitHub
commit 5241753ce5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -18,8 +18,8 @@
package account package account
import ( import (
"bytes"
"crypto/rand" "crypto/rand"
"crypto/subtle"
"database/sql" "database/sql"
"encoding/base64" "encoding/base64"
"errors" "errors"
@ -51,7 +51,7 @@ func Login(username, password string) (LoginResponse, error) {
return response, err return response, err
} }
if !bytes.Equal(key, deriveArgon2IDKey([]byte(password), salt)) { if subtle.ConstantTimeCompare(key, deriveArgon2IDKey([]byte(password), salt)) == 0 {
return response, fmt.Errorf("password doesn't match") return response, fmt.Errorf("password doesn't match")
} }