Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Merge pull request from GHSA-3rqj-9v87-2x3f

Maciej Korycinski780ff3e54ea6
diff --git a/saleor/payment/gateways/adyen/webhooks.py b/saleor/payment/gateways/adyen/webhooks.py
index 84e37842b2..bcbe7ef86f 100644
--- a/saleor/payment/gateways/adyen/webhooks.py
+++ b/saleor/payment/gateways/adyen/webhooks.py
@@ -909,7 +909,7 @@ def validate_hmac_signature(
if not hmac_key:
return not hmac_signature
- if not hmac_signature and hmac_key:
+ if not hmac_signature:
return False
hmac_key = hmac_key.encode()
@@ -933,7 +933,7 @@ def validate_hmac_signature(
hmac_key = binascii.a2b_hex(hmac_key)
hm = hmac.new(hmac_key, payload.encode("utf-8"), hashlib.sha256)
expected_merchant_sign = base64.b64encode(hm.digest())
- return hmac_signature == expected_merchant_sign.decode("utf-8")
+ return hmac.compare_digest(hmac_signature, expected_merchant_sign.decode("utf-8"))
def validate_auth_user(headers: HttpHeaders, gateway_config: "GatewayConfig") -> bool: