mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-10-10 17:24:02 +02:00
1 parent
f94bad547e
commit
51f808c3f9
1 file changed
+4
-1
@@ -67,7 +67,10 @@ func handleAPISession(
|
||||
}
|
||||
incomingHash := sha256.Sum256([]byte(headerAPIKey))
|
||||
found := false
|
||||
// Must check ALL keys in constant time
|
||||
// compare each key using constant-time comparison to avoid hash timing leaks.
|
||||
// early exit via break is acceptable here because the key slice is derived from
|
||||
// a go map, which randomizes iteration order on every call — an attacker cannot
|
||||
// correlate iteration count to a stable key position across requests.
|
||||
var rApiUser *model.APIUser
|
||||
for _, apiUser := range apiUsers {
|
||||
if subtle.ConstantTimeCompare(incomingHash[:], apiUser.APIKeyHash[:]) == 1 {
|
||||
|
||||
Reference in new issue
Block a user