mirror of https://github.com/zulip/zulip.git
6dd6fc045f
The endpoint was lacking validation that the authentication_methods dict submitted by the user made sense. So e.g. it allowed submitting a nonsense key like NoSuchBackend or modifying the realm's configured authentication methods for a backend that's not enabled on the server, which should not be allowed. Both were ultimately harmless, because: 1. Submitting NoSuchBackend would luckily just trigger a KeyError inside the transaction.atomic() block in do_set_realm_authentication_methods so it would actually roll back the database changes it was trying to make. So this couldn't actually create some weird RealmAuthenticationMethod entries. 2. Silently enabling or disabling e.g. GitHub for a realm when GitHub isn't enabled on the server doesn't really change anything. And this action is only available to the realm's admins to begin with, so there's no attack vector here. test_supported_backends_only_updated wasn't actually testing anything, because the state it was asserting: ``` self.assertFalse(github_auth_enabled(realm)) self.assertTrue(dev_auth_enabled(realm)) self.assertFalse(password_auth_enabled(realm)) ``` matched the desired state submitted to the API... ``` result = self.client_patch( "/json/realm", { "authentication_methods": orjson.dumps( {"Email": False, "Dev": True, "GitHub": False} ).decode() }, ) ``` so we just replace it with a new test that tests the param validation. |
||
---|---|---|
.. | ||
__init__.py | ||
alert_words.py | ||
bots.py | ||
create_realm.py | ||
create_user.py | ||
custom_profile_fields.py | ||
default_streams.py | ||
hotspots.py | ||
invites.py | ||
message_delete.py | ||
message_edit.py | ||
message_flags.py | ||
message_send.py | ||
muted_users.py | ||
presence.py | ||
reactions.py | ||
realm_domains.py | ||
realm_emoji.py | ||
realm_export.py | ||
realm_icon.py | ||
realm_linkifiers.py | ||
realm_logo.py | ||
realm_playgrounds.py | ||
realm_settings.py | ||
scheduled_messages.py | ||
streams.py | ||
submessage.py | ||
typing.py | ||
uploads.py | ||
user_activity.py | ||
user_groups.py | ||
user_settings.py | ||
user_status.py | ||
user_topics.py | ||
users.py | ||
video_calls.py |