Don't allow clients to send tombstones that reference the same room

This commit is contained in:
Erik Johnston 2019-07-31 15:52:27 +01:00
parent 72167fb394
commit f31d4cb7a2

View file

@ -106,6 +106,13 @@ class EventValidator(object):
if event.content["membership"] not in Membership.LIST: if event.content["membership"] not in Membership.LIST:
raise SynapseError(400, "Invalid membership key") 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): def _ensure_strings(self, d, keys):
for s in keys: for s in keys:
if s not in d: if s not in d: