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

Commit b832264

Browse files
committed
Add Erik's explanation of extra event checks
See #10498 (comment)
1 parent 71c2f05 commit b832264

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

synapse/handlers/federation.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,12 @@ async def on_receive_pdu(
263263

264264
state = None
265265

266-
# Get missing pdus if necessary.
267-
# We don't need to worry about outliers because TODO!
266+
# Check that the event passes auth based on the state at the event. This is
267+
# done for events that are to be added to the timeline (non-outliers).
268+
#
269+
# Get missing pdus if necessary:
270+
# - Fetching any missing prev events to fill in gaps in the graph
271+
# - Fetching state if we have a hole in the graph
268272
if not pdu.internal_metadata.is_outlier():
269273
# We only backfill backwards to the min depth.
270274
min_depth = await self.get_min_depth_for_context(pdu.room_id)
@@ -434,6 +438,13 @@ async def on_receive_pdu(
434438
affected=event_id,
435439
)
436440

441+
# A second round of checks for all events. Check that the event passes auth
442+
# based on `auth_events`, this allows us to assert that the event would
443+
# have been allowed at some point. If an event passes this check its OK
444+
# for it to be used as part of a returned `/state` request, as either
445+
# a) we received the event as part of the original join and so trust it, or
446+
# b) we'll do a state resolution with existing state before it becomes
447+
# part of the "current state", which adds more protection.
437448
await self._process_received_pdu(origin, pdu, state=state)
438449

439450
async def _get_missing_events_for_pdu(

0 commit comments

Comments
 (0)