zulip/zerver/actions
Mateusz Mandera 6dd6fc045f realm_settings: Improve authentication_methods param validation.
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.
2024-02-02 17:26:32 -08:00
..
__init__.py
alert_words.py actions: Split out zerver.actions.alert_words. 2022-04-14 17:14:31 -07:00
bots.py models: Extract zerver.models.users. 2023-12-16 22:08:44 -08:00
create_realm.py actions: Rename *topic local variables to *topic_name. 2024-01-15 09:40:43 -08:00
create_user.py models: Extract zerver.models.groups. 2023-12-16 22:08:44 -08:00
custom_profile_fields.py models: Extract zerver.models.custom_profile_fields. 2023-12-16 22:08:44 -08:00
default_streams.py models: Extract zerver.models.streams. 2023-12-16 22:08:44 -08:00
hotspots.py events: Add 'onboarding_steps' event deprecating 'hotspots'. 2023-12-06 18:19:20 -08:00
invites.py models: Extract zerver.models.prereg_users. 2023-12-16 22:08:44 -08:00
message_delete.py models: Always search Messages with a realm_id or id limit. 2023-09-11 15:00:37 -07:00
message_edit.py requirements: Upgrade Python requirements. 2024-01-29 10:41:54 -08:00
message_flags.py python: Elide unnecessary list wrappers. 2023-09-13 12:41:23 -07:00
message_send.py actions: Rename *topic local variables to *topic_name. 2024-01-15 09:40:43 -08:00
muted_users.py python: Consistently use from…import for datetime. 2023-12-05 12:01:18 -08:00
presence.py presence: Avoid having incomplete missing test coverage. 2024-01-14 18:32:01 -08:00
reactions.py actions: Rename *topic local variables to *topic_name. 2024-01-15 09:40:43 -08:00
realm_domains.py models: Extract zerver.models.realms. 2023-12-16 22:08:44 -08:00
realm_emoji.py models: Extract zerver.models.realm_emoji. 2023-12-16 22:08:44 -08:00
realm_export.py migration: Rename extra_data_json to extra_data in audit log models. 2023-08-16 17:18:14 -07:00
realm_icon.py models: Extract zerver.models.users. 2023-12-16 22:08:44 -08:00
realm_linkifiers.py models: Extract zerver.models.linkifiers. 2023-12-16 22:08:44 -08:00
realm_logo.py models: Extract zerver.models.users. 2023-12-16 22:08:44 -08:00
realm_playgrounds.py models: Extract zerver.models.realm_playgrounds. 2023-12-16 22:08:44 -08:00
realm_settings.py realm_settings: Improve authentication_methods param validation. 2024-02-02 17:26:32 -08:00
scheduled_messages.py actions: Rename *topic local variables to *topic_name. 2024-01-15 09:40:43 -08:00
streams.py actions: Rename *topic local variables to *topic_name. 2024-01-15 09:40:43 -08:00
submessage.py actions: Rename *topic local variables to *topic_name. 2024-01-15 09:40:43 -08:00
typing.py actions: Rename *topic local variables to *topic_name. 2024-01-15 09:40:43 -08:00
uploads.py models: Move some functions to zerver.lib.attachments. 2023-12-16 22:08:44 -08:00
user_activity.py queue_processors: Process user_activity in one query. 2024-01-22 16:25:13 -08:00
user_groups.py models: Extract zerver.models.groups. 2023-12-16 22:08:44 -08:00
user_settings.py models: Extract zerver.models.clients. 2023-12-16 22:08:44 -08:00
user_status.py users: Update presence and user status code to support restricted users. 2023-11-21 23:58:45 -08:00
user_topics.py actions: Rename *topic local variables to *topic_name. 2024-01-15 09:40:43 -08:00
users.py models: Extract zerver.models.bots. 2023-12-16 22:08:44 -08:00
video_calls.py