summary refs log tree commit diff
path: root/synapse/handlers/federation.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-05-18 11:28:04 +0100
committerGitHub <noreply@github.com>2018-05-18 11:28:04 +0100
commit6d9dc671391dadb75e8c0d860c7f1eb3e27681ec (patch)
tree55fd9ea0d7aadde8829adaf270a69f72363d360b /synapse/handlers/federation.py
parentMerge pull request #3235 from matrix-org/rav/fix_receipts_deferred (diff)
parentBetter docstrings (diff)
downloadsynapse-6d9dc671391dadb75e8c0d860c7f1eb3e27681ec.tar.xz
Merge pull request #3232 from matrix-org/rav/server_notices_room
Infrastructure for a server notices room
Diffstat (limited to 'synapse/handlers/federation.py')
-rw-r--r--synapse/handlers/federation.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index f39233d846..ba3ede8024 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -81,6 +81,7 @@ class FederationHandler(BaseHandler):
         self.pusher_pool = hs.get_pusherpool()
         self.spam_checker = hs.get_spam_checker()
         self.event_creation_handler = hs.get_event_creation_handler()
+        self._server_notices_mxid = hs.config.server_notices_mxid
 
         # When joining a room we need to queue any events for that room up
         self.room_queues = {}
@@ -1180,6 +1181,13 @@ class FederationHandler(BaseHandler):
         if not self.is_mine_id(event.state_key):
             raise SynapseError(400, "The invite event must be for this server")
 
+        # block any attempts to invite the server notices mxid
+        if event.state_key == self._server_notices_mxid:
+            raise SynapseError(
+                http_client.FORBIDDEN,
+                "Cannot invite this user",
+            )
+
         event.internal_metadata.outlier = True
         event.internal_metadata.invite_from_remote = True