summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-03-21 12:11:40 +0000
committerErik Johnston <erik@matrix.org>2019-03-21 12:48:37 +0000
commitb7d7d20a38b3ce21485c022c3162857a53d0beb8 (patch)
tree5e92b905a1c06f862fa6b1b42ca116488e443575 /synapse/events
parentTurn off newsfile check (diff)
downloadsynapse-b7d7d20a38b3ce21485c022c3162857a53d0beb8.tar.xz
Correctly handle 3PID invites in create room spam check
We also add an option to outright deny third party invites
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/spamcheck.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/events/spamcheck.py b/synapse/events/spamcheck.py
index e4fc988cfc..87d66a9703 100644
--- a/synapse/events/spamcheck.py
+++ b/synapse/events/spamcheck.py
@@ -69,7 +69,8 @@ class SpamChecker(object):
             inviter_userid, invitee_userid, room_id, new_room,
         )
 
-    def user_may_create_room(self, userid, invite_list, cloning):
+    def user_may_create_room(self, userid, invite_list, third_party_invite_list,
+                             cloning):
         """Checks if a given user may create a room
 
         If this method returns false, the creation request will be rejected.
@@ -78,6 +79,8 @@ class SpamChecker(object):
             userid (string): The sender's user ID
             invite_list (list[str]): List of user IDs that would be invited to
                 the new room.
+            third_party_invite_list (list[dict]): List of third party invites
+                for the new room.
             cloning (bool): Whether the user is cloning an existing room, e.g.
                 upgrading a room.
 
@@ -87,7 +90,9 @@ class SpamChecker(object):
         if self.spam_checker is None:
             return True
 
-        return self.spam_checker.user_may_create_room(userid, invite_list, cloning)
+        return self.spam_checker.user_may_create_room(
+            userid, invite_list, third_party_invite_list, cloning,
+        )
 
     def user_may_create_room_alias(self, userid, room_alias):
         """Checks if a given user may create a room alias