Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
decorator: Check Tornado secret with constant-time comparison.
Anders Kaseorg668a215ef935
diff --git a/zerver/decorator.py b/zerver/decorator.pyindex 904fca61303..1739137f5c6 100644--- a/zerver/decorator.py+++ b/zerver/decorator.py@@ -921,7 +921,9 @@ def is_local_addr(addr: str) -> bool:# secret, and also the originating IP (for now).@has_request_variablesdef authenticate_notify(request: HttpRequest, secret: str = REQ("secret")) -> bool:- return is_local_addr(request.META["REMOTE_ADDR"]) and secret == settings.SHARED_SECRET+ return is_local_addr(request.META["REMOTE_ADDR"]) and constant_time_compare(+ secret, settings.SHARED_SECRET+ )def client_is_exempt_from_rate_limiting(request: HttpRequest) -> bool: