summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
Diffstat (limited to 'synapse')
-rw-r--r--synapse/events/validator.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/events/validator.py b/synapse/events/validator.py
index f7ffd1d561..6374dd067d 100644
--- a/synapse/events/validator.py
+++ b/synapse/events/validator.py
@@ -106,6 +106,15 @@ 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 the room it was sent in"
+                )
+
     def _ensure_strings(self, d, keys):
         for s in keys:
             if s not in d: