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 #5802 from matrix-org/erikj/deny_redacting_differe…
Browse files Browse the repository at this point in the history
…nt_room

Deny redaction of events in a different room.
  • Loading branch information
erikjohnston authored Aug 1, 2019
2 parents 0f632f3 + 0eefb76 commit 58af30a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/5802.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deny redactions of events sent in a different room.
4 changes: 3 additions & 1 deletion synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,16 @@ def is_inviter_member_event(e):
get_prev_content=False,
allow_rejected=False,
allow_none=True,
check_room_id=event.room_id,
)

# we can make some additional checks now if we have the original event.
if original_event:
if original_event.type == EventTypes.Create:
raise AuthError(403, "Redacting create events is not permitted")

if original_event.room_id != event.room_id:
raise SynapseError(400, "Cannot redact event from a different room")

prev_state_ids = yield context.get_prev_state_ids(self.store)
auth_events_ids = yield self.auth.compute_auth_events(
event, prev_state_ids, for_verification=True
Expand Down

0 comments on commit 58af30a

Please sign in to comment.