summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-02-20 15:49:08 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-02-20 15:49:08 +0000
commit233743a408bd11599e1da18b554ebf7a86d20c47 (patch)
tree3080547a4dc2bb8be04540d3a6968ef8b36a42d1 /synapse/events
parentMerge pull request #5802 from matrix-org/erikj/deny_redacting_different_room (diff)
parentMerge pull request #5801 from matrix-org/erikj/recursive_tombstone (diff)
downloadsynapse-233743a408bd11599e1da18b554ebf7a86d20c47.tar.xz
Merge pull request #5801 from matrix-org/erikj/recursive_tombstone
Diffstat (limited to 'synapse/events')
-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 9df9287aa7..9f2ba7218a 100644
--- a/synapse/events/validator.py
+++ b/synapse/events/validator.py
@@ -200,6 +200,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: