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

log when a redaction attempts to redact an event in a different room #5767

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5767.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Log when a redaction attempts to redact an event in a different room.
27 changes: 27 additions & 0 deletions synapse/storage/events_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ def get_events_as_list(
)
continue

if original_event.room_id != entry.event.room_id:
logger.info(
"Withholding redaction %s of event %s from a different room",
event_id,
redacted_event_id,
)
continue

if entry.event.internal_metadata.need_to_check_redaction():
original_domain = get_domain_from_id(original_event.sender)
redaction_domain = get_domain_from_id(entry.event.sender)
Expand Down Expand Up @@ -636,9 +644,21 @@ def _maybe_redact_event_row(self, original_ev, redactions):
if not redaction_entry:
# we don't have the redaction event, or the redaction event was not
# authorized.
logger.debug(
"%s was redacted by %s but redaction not found/authed",
original_ev.event_id,
redaction_id,
)
continue

redaction_event = redaction_entry.event
if redaction_event.room_id != original_ev.room_id:
logger.debug(
"%s was redacted by %s but redaction was in a different room!",
original_ev.event_id,
redaction_id,
)
continue

# Starting in room version v3, some redactions need to be
# rechecked if we didn't have the redacted event at the
Expand All @@ -650,8 +670,15 @@ def _maybe_redact_event_row(self, original_ev, redactions):
redaction_event.internal_metadata.recheck_redaction = False
else:
# Senders don't match, so the event isn't actually redacted
logger.debug(
"%s was redacted by %s but the senders don't match",
original_ev.event_id,
redaction_id,
)
continue

logger.debug("Redacting %s due to %s", original_ev.event_id, redaction_id)

# we found a good redaction event. Redact!
redacted_event = prune_event(original_ev)
redacted_event.unsigned["redacted_by"] = redaction_id
Expand Down