Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
zilencer: Limit all hostname lookups with deactivated=False.
Alex Vandiver3d1a4e718e66
diff --git a/zilencer/views.py b/zilencer/views.pyindex 8be84b07285..16f8d12c368 100644--- a/zilencer/views.py+++ b/zilencer/views.py@@ -178,7 +178,7 @@ def validate_hostname_or_raise_error(hostname: str) -> None:def transfer_remote_server_registration(request: HttpRequest, *, hostname: str) -> HttpResponse:validate_hostname_or_raise_error(hostname)- if not RemoteZulipServer.objects.filter(hostname=hostname).exists():+ if not RemoteZulipServer.objects.filter(hostname=hostname, deactivated=False).exists():raise JsonableError(_("{hostname} not yet registered").format(hostname=hostname))verification_secret = generate_registration_transfer_verification_secret(hostname)@@ -271,7 +271,10 @@ def register_remote_server(if remote_server.deactivated:raise RemoteServerDeactivatedError- if remote_server is None and RemoteZulipServer.objects.filter(hostname=hostname).exists():+ if (+ remote_server is None+ and RemoteZulipServer.objects.filter(hostname=hostname, deactivated=False).exists()+ ):raise HostnameAlreadyInUseBouncerError(hostname)with transaction.atomic(durable=True):@@ -357,7 +360,7 @@ def verify_registration_transfer_challenge_ack_endpoint()try:- remote_server = RemoteZulipServer.objects.get(hostname=hostname)+ remote_server = RemoteZulipServer.objects.get(hostname=hostname, deactivated=False)except RemoteZulipServer.DoesNotExist:raise JsonableError(_("Registration not found for this hostname"))