summary refs log tree commit diff
path: root/synapse/event_auth.py
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-08-08 16:13:03 +0000
committerGitHub <noreply@github.com>2018-08-08 16:13:03 +0000
commit5298d79fb58b8792bc0dd3b4a34b84339d4f4845 (patch)
treedaedd358c898cd879bb5eb365f0f466d6944883b /synapse/event_auth.py
parentMerge branch 'develop' into neilj/disable_hs (diff)
parentMerge pull request #3654 from matrix-org/rav/room_versions (diff)
downloadsynapse-5298d79fb58b8792bc0dd3b4a34b84339d4f4845.tar.xz
Merge branch 'develop' into neilj/disable_hs
Diffstat (limited to 'synapse/event_auth.py')
-rw-r--r--synapse/event_auth.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/event_auth.py b/synapse/event_auth.py
index b32f64e729..6baeccca38 100644
--- a/synapse/event_auth.py
+++ b/synapse/event_auth.py
@@ -20,7 +20,7 @@ from signedjson.key import decode_verify_key_bytes
 from signedjson.sign import SignatureVerifyException, verify_signed_json
 from unpaddedbase64 import decode_base64
 
-from synapse.api.constants import EventTypes, JoinRules, Membership
+from synapse.api.constants import KNOWN_ROOM_VERSIONS, EventTypes, JoinRules, Membership
 from synapse.api.errors import AuthError, EventSizeError, SynapseError
 from synapse.types import UserID, get_domain_from_id
 
@@ -83,6 +83,14 @@ def check(event, auth_events, do_sig_check=True, do_size_check=True):
                 403,
                 "Creation event's room_id domain does not match sender's"
             )
+
+        room_version = event.content.get("room_version", "1")
+        if room_version not in KNOWN_ROOM_VERSIONS:
+            raise AuthError(
+                403,
+                "room appears to have unsupported version %s" % (
+                    room_version,
+                ))
         # FIXME
         logger.debug("Allowing! %s", event)
         return