From 0f2ecb961e580d5d039360edf041720680f8ad8c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 26 Jul 2019 06:36:48 +0000 Subject: [PATCH] Fix DoS when there is a cycle in redaction events Make sure that synapse doesn't explode when a redaction redacts itself, or there is a larger cycle. --- synapse/storage/events_worker.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/synapse/storage/events_worker.py b/synapse/storage/events_worker.py index 7dbb5df09a34..06379281b63a 100644 --- a/synapse/storage/events_worker.py +++ b/synapse/storage/events_worker.py @@ -637,6 +637,10 @@ def _maybe_redact_event_row(self, original_ev, redactions): # we choose to ignore redactions of m.room.create events. return None + if original_ev.type == "m.room.redaction": + # ... and redaction events + return None + redaction_map = yield self._get_events_from_cache_or_db(redactions) for redaction_id in redactions: