summary refs log tree commit diff
path: root/synapse/server_notices/server_notices_manager.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-05-23 14:30:47 +0100
committerRichard van der Hoff <richard@matrix.org>2018-05-23 14:30:47 +0100
commit321f02d26347fb56e1eafbba60d7faef95ae9c3f (patch)
treeeeadbff47b4ecb0a2bb4b6d4457951296e5fd0c6 /synapse/server_notices/server_notices_manager.py
parentstyle (diff)
downloadsynapse-321f02d26347fb56e1eafbba60d7faef95ae9c3f.tar.xz
Block attempts to send server notices to remote users
Diffstat (limited to 'synapse/server_notices/server_notices_manager.py')
-rw-r--r--synapse/server_notices/server_notices_manager.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/server_notices/server_notices_manager.py b/synapse/server_notices/server_notices_manager.py
index f535b9c9da..9f76c75546 100644
--- a/synapse/server_notices/server_notices_manager.py
+++ b/synapse/server_notices/server_notices_manager.py
@@ -35,6 +35,7 @@ class ServerNoticesManager(object):
         self._config = hs.config
         self._room_creation_handler = hs.get_room_creation_handler()
         self._event_creation_handler = hs.get_event_creation_handler()
+        self._is_mine_id = hs.is_mine_id
 
     def is_enabled(self):
         """Checks if server notices are enabled on this server.
@@ -89,6 +90,9 @@ class ServerNoticesManager(object):
         if not self.is_enabled():
             raise Exception("Server notices not enabled")
 
+        assert self._is_mine_id(user_id), \
+            "Cannot send server notices to remote users"
+
         rooms = yield self._store.get_rooms_for_user_where_membership_is(
             user_id, [Membership.INVITE, Membership.JOIN],
         )