Skip to content

Commit 1018ff7

Browse files
committed
Prevent timing attack on HMAC #12152
1 parent 88ce693 commit 1018ff7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Middleware/SignedQueryMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private function verifyHash(ServerRequestInterface $request, string $timestamp,
9696

9797
foreach ($this->keys as $name => $value) {
9898
$computedHash = hash_hmac('sha256', $payload, $value);
99-
if ($hash === $computedHash) {
99+
if (hash_equals($hash, $computedHash)) {
100100
return $request->withAttribute($this::class, $name);
101101
}
102102
}

0 commit comments

Comments
 (0)