summary refs log tree commit diff
path: root/synapse/events/validator.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-07-31 15:52:27 +0100
committerErik Johnston <erik@matrix.org>2019-07-31 15:52:27 +0100
commitf31d4cb7a2e90b337f60ef06a3d31c0be9ad667c (patch)
treefb1f7d0b461906e3ad90c4f24f5d457ab1a0e144 /synapse/events/validator.py
parentChange user deactivated errcode to USER_DEACTIVATED and use it (#5686) (diff)
downloadsynapse-f31d4cb7a2e90b337f60ef06a3d31c0be9ad667c.tar.xz
Don't allow clients to send tombstones that reference the same room
Diffstat (limited to 'synapse/events/validator.py')
-rw-r--r--synapse/events/validator.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/events/validator.py b/synapse/events/validator.py
index f7ffd1d561..29f99361c0 100644
--- a/synapse/events/validator.py
+++ b/synapse/events/validator.py
@@ -106,6 +106,13 @@ class EventValidator(object):
             if event.content["membership"] not in Membership.LIST:
                 raise SynapseError(400, "Invalid membership key")
 
+        elif event.type == EventTypes.Tombstone:
+            if "replacement_room" not in event.content:
+                raise SynapseError(400, "Content has no replacement_room key")
+
+            if event.content["replacement_room"] == event.room_id:
+                raise SynapseError(400, "Tombstone cannot reference itself")
+
     def _ensure_strings(self, d, keys):
         for s in keys:
             if s not in d: