Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
webhooks: Check HMAC signature with constant_time_compare.
Anders Kaseorg149a99396c00
diff --git a/zerver/lib/webhooks/common.py b/zerver/lib/webhooks/common.pyindex 296441276b3..21bc7f73718 100644--- a/zerver/lib/webhooks/common.py+++ b/zerver/lib/webhooks/common.py@@ -10,6 +10,7 @@ from urllib.parse import unquotefrom django.conf import settingsfrom django.http import HttpRequest+from django.utils.crypto import constant_time_comparefrom django.utils.encoding import force_bytesfrom django.utils.translation import gettext as _from pydantic import Json@@ -341,7 +342,7 @@ def validate_webhook_signature(algorithm,).hexdigest()- if signed_payload != signature:+ if not constant_time_compare(signed_payload, signature):raise JsonableError(_("Webhook signature verification failed."))