summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-02-06 13:25:24 -0500
committerGitHub <noreply@github.com>2020-02-06 13:25:24 -0500
commit7765bf398996002ee461904915de9d8bc2ea951a (patch)
treeab9da9bfcb21113fed8332bc49f9ec8dd783a24d /synapse
parentpass room version into FederationClient.send_join (#6854) (diff)
downloadsynapse-7765bf398996002ee461904915de9d8bc2ea951a.tar.xz
Limit the number of events that can be requested when backfilling events (#6864)
Limit the maximum number of events requested when backfilling events.
Diffstat (limited to '')
-rw-r--r--synapse/handlers/federation.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 10e8b6ea4c..eb20ef4aec 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -1788,6 +1788,9 @@ class FederationHandler(BaseHandler):
         if not in_room:
             raise AuthError(403, "Host not in room.")
 
+        # Synapse asks for 100 events per backfill request. Do not allow more.
+        limit = min(limit, 100)
+
         events = yield self.store.get_backfill_events(room_id, pdu_list, limit)
 
         events = yield filter_events_for_server(self.storage, origin, events)
@@ -2168,6 +2171,7 @@ class FederationHandler(BaseHandler):
         if not in_room:
             raise AuthError(403, "Host not in room.")
 
+        # Only allow up to 20 events to be retrieved per request.
         limit = min(limit, 20)
 
         missing_events = await self.store.get_missing_events(