Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5801 from matrix-org/erikj/recursive_tombstone
Browse files Browse the repository at this point in the history
Don't allow clients to send tombstones that reference the same room
  • Loading branch information
erikjohnston authored Aug 1, 2019
2 parents 58af30a + 76a58fd commit 0b36dec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/5801.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't allow clients to send tombstone events that reference the room it's sent in.
9 changes: 9 additions & 0 deletions synapse/events/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ def validate_builder(self, event):
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:
Expand Down

0 comments on commit 0b36dec

Please sign in to comment.