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

Commit 95c6900

Browse files
committed
Also auth the join event itself
1 parent 55e9964 commit 95c6900

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

synapse/handlers/federation_event.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)