@@ -463,13 +463,16 @@ async def process_remote_join(
463463 await self ._auth_and_persist_outliers (room_id , event_map .values ())
464464
465465 # and now persist the join event itself.
466- new_event_context = await self ._state_handler .compute_event_context (
467- event , old_state = state
468- )
466+ with nested_logging_context (suffix = event .event_id ):
467+ context = await self ._state_handler .compute_event_context (
468+ event , old_state = state
469+ )
469470
470- return await self .persist_events_and_notify (
471- room_id , [(event , new_event_context )]
472- )
471+ context = await self ._check_event_auth (origin , event , context )
472+ if context .rejected :
473+ raise SynapseError (400 , "Join event was rejected" )
474+
475+ return await self .persist_events_and_notify (room_id , [(event , context )])
473476
474477 @log_function
475478 async def backfill (
@@ -942,9 +945,15 @@ async def _process_received_pdu(
942945 ) -> None :
943946 """Called when we have a new non-outlier event.
944947
945- This is called when we have a new event to add to the room DAG - either directly
946- via a /send request, retrieved via get_missing_events after a /send request, or
947- backfilled after a client request.
948+ This is called when we have a new event to add to the room DAG. This can be
949+ due to:
950+ * events received directly via a /send request
951+ * events retrieved via get_missing_events after a /send request
952+ * events backfilled after a client request.
953+
954+ It's not currently used for events received from incoming send_{join,knock,leave}
955+ requests (which go via on_send_membership_event), nor for joins created by a
956+ remote join dance (which go via process_remote_join).
948957
949958 We need to do auth checks and put it through the StateHandler.
950959
0 commit comments