summary refs log tree commit diff
path: root/synapse/handlers/federation.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-01-29 16:38:29 +0000
committerGitHub <noreply@github.com>2021-01-29 16:38:29 +0000
commitf2c1560eca1e2160087a280261ca78d0708ad721 (patch)
tree3588043082a6da91569202eacff867be2d04a507 /synapse/handlers/federation.py
parentFix Debian builds on Xenial (#9254) (diff)
downloadsynapse-f2c1560eca1e2160087a280261ca78d0708ad721.tar.xz
Ratelimit invites by room and target user (#9258)
Diffstat (limited to 'synapse/handlers/federation.py')
-rw-r--r--synapse/handlers/federation.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index b6dc7f99b6..dbdfd56ff5 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -1617,6 +1617,10 @@ class FederationHandler(BaseHandler):
         if event.state_key == self._server_notices_mxid:
             raise SynapseError(HTTPStatus.FORBIDDEN, "Cannot invite this user")
 
+        # We retrieve the room member handler here as to not cause a cyclic dependency
+        member_handler = self.hs.get_room_member_handler()
+        member_handler.ratelimit_invite(event.room_id, event.state_key)
+
         # keep a record of the room version, if we don't yet know it.
         # (this may get overwritten if we later get a different room version in a
         # join dance).