summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-23 17:10:11 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-23 17:10:11 +0000
commit99eeff7c12a8ca2c27d40c7df1de22069e6fb648 (patch)
tree0c8e1998506cf29c23c4e95306d1b0368fa2a416
parentpass room version into FederationClient.send_join (#6854) (diff)
parentLimit the number of events that can be requested when backfilling events (#6864) (diff)
downloadsynapse-99eeff7c12a8ca2c27d40c7df1de22069e6fb648.tar.xz
Limit the number of events that can be requested when backfilling events (#6864)
* commit '7765bf398':
  Limit the number of events that can be requested when backfilling events (#6864)
-rw-r--r--changelog.d/6864.misc1
-rw-r--r--synapse/handlers/federation.py4
2 files changed, 5 insertions, 0 deletions
diff --git a/changelog.d/6864.misc b/changelog.d/6864.misc
new file mode 100644

index 0000000000..d24eb68460 --- /dev/null +++ b/changelog.d/6864.misc
@@ -0,0 +1 @@ +Limit the number of events that can be requested by the backfill federation API to 100. diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 6862b49bdd..1ec61340ad 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py
@@ -1799,6 +1799,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) @@ -2179,6 +2182,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(