Fixing timing attack vuln. on HMAC comparison (#409)

This commit is contained in:
Fillerino 2017-04-24 22:49:03 +02:00 committed by Dane Everitt
parent a35788da34
commit 5cc28a0716

View file

@ -170,7 +170,7 @@ class HMACAuthorization
*/
protected function validateContents()
{
if (base64_decode($this->hash()) !== $this->generateSignature()) {
if (! hash_equals(base64_decode($this->hash()), $this->generateSignature())) {
throw new BadRequestHttpException('The HMAC for the request was invalid.');
}
}