summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-07-26 06:36:48 +0000
committerRichard van der Hoff <richard@matrix.org>2019-07-26 06:36:48 +0000
commit0f2ecb961e580d5d039360edf041720680f8ad8c (patch)
treeebdafd9c74b455c161fca911f527cbb967de5112
parentMerge branch 'rav/redactions/cross_room_id' into release-v1.2.1 (diff)
downloadsynapse-0f2ecb961e580d5d039360edf041720680f8ad8c.tar.xz
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.
-rw-r--r--synapse/storage/events_worker.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/storage/events_worker.py b/synapse/storage/events_worker.py
index 7dbb5df09a..06379281b6 100644
--- a/synapse/storage/events_worker.py
+++ b/synapse/storage/events_worker.py
@@ -637,6 +637,10 @@ class EventsWorkerStore(SQLBaseStore):
             # 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: