Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

auth: Don't leak info about accounts in other realms in the login form.

Mateusz Mandera163910b765ed
diff --git a/zerver/forms.py b/zerver/forms.py
index adae81ce609..86e7917f822 100644
--- a/zerver/forms.py
+++ b/zerver/forms.py
@@ -466,13 +466,9 @@ class OurAuthenticationForm(AuthenticationForm):
subdomain,
return_data.get("matching_user_ids_in_different_realms"),
)
- error_message = _(
- "Your Zulip account {username} is not a member of the "
- + "organization associated with this subdomain. "
- + "Please contact your organization administrator with any questions."
- )
- error_message = error_message.format(username=username)
- raise ValidationError(error_message)
+ # We don't want to leak information by revealing there are matching accounts
+ # on different subdomain - so we just fall through to the default error.
+ assert self.user_cache is None
if self.user_cache is None:
raise forms.ValidationError(
diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py
index a26d1dbb26f..4004ac7092a 100644
--- a/zerver/tests/test_signup.py
+++ b/zerver/tests/test_signup.py
@@ -834,8 +834,7 @@ class LoginTest(ZulipTestCase):
)
self.assertEqual(result.status_code, 200)
expected_error = (
- f"Your Zulip account {email} is not a member of the "
- + "organization associated with this subdomain."
+ "Please enter a correct email and password. Note that both fields may be case-sensitive"
)
self.assert_in_response(expected_error, result)
self.assert_logged_in_user_id(None)