diff options
author | Erik Johnston <erik@matrix.org> | 2021-01-29 16:38:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 16:38:29 +0000 |
commit | f2c1560eca1e2160087a280261ca78d0708ad721 (patch) | |
tree | 3588043082a6da91569202eacff867be2d04a507 /synapse/handlers/room.py | |
parent | Fix Debian builds on Xenial (#9254) (diff) | |
download | synapse-f2c1560eca1e2160087a280261ca78d0708ad721.tar.xz |
Ratelimit invites by room and target user (#9258)
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r-- | synapse/handlers/room.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index ee27d99135..07b2187eb1 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -126,6 +126,10 @@ class RoomCreationHandler(BaseHandler): self.third_party_event_rules = hs.get_third_party_event_rules() + self._invite_burst_count = ( + hs.config.ratelimiting.rc_invites_per_room.burst_count + ) + async def upgrade_room( self, requester: Requester, old_room_id: str, new_version: RoomVersion ) -> str: @@ -662,6 +666,9 @@ class RoomCreationHandler(BaseHandler): invite_3pid_list = [] invite_list = [] + if len(invite_list) + len(invite_3pid_list) > self._invite_burst_count: + raise SynapseError(400, "Cannot invite so many users at once") + await self.event_creation_handler.assert_accepted_privacy_policy(requester) power_level_content_override = config.get("power_level_content_override") |