summary refs log tree commit diff
path: root/synapse/api/auth.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-09-01 15:15:19 +0100
committerErik Johnston <erik@matrix.org>2015-09-01 15:21:24 +0100
commitab9e01809def16dca19d6391ab1234eaa423b182 (patch)
tree5dc10eae39acaa23e649dd45ad94f147ca67b4d4 /synapse/api/auth.py
parentMerge pull request #264 from matrix-org/markjh/syweb_on_pypi (diff)
downloadsynapse-ab9e01809def16dca19d6391ab1234eaa423b182.tar.xz
Check room exists when authenticating an event, by asserting they reference a creation event
Diffstat (limited to '')
-rw-r--r--synapse/api/auth.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 65ee1452ce..410f4c11e7 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -65,6 +65,14 @@ class Auth(object):
                 # FIXME
                 return True
 
+            creation_event = auth_events.get((EventTypes.Create, ""), None)
+
+            if not creation_event:
+                raise SynapseError(
+                    400,
+                    "Room %r does not exist" % (event.room_id,)
+                )
+
             # FIXME: Temp hack
             if event.type == EventTypes.Aliases:
                 return True