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

Commit

Permalink
Reject history insertion during partial joins (#14291)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson authored Oct 27, 2022
1 parent 40fa829 commit cbe01cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/14291.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent history insertion ([MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716)) during an partial join ([MSC3706](https://github.com/matrix-org/matrix-spec-proposals/pull/3706)).
7 changes: 7 additions & 0 deletions synapse/rest/client/room_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ async def on_POST(
errcode=Codes.MISSING_PARAM,
)

if await self.store.is_partial_state_room(room_id):
raise SynapseError(
HTTPStatus.BAD_REQUEST,
"Cannot insert history batches until we have fully joined the room",
errcode=Codes.UNABLE_DUE_TO_PARTIAL_STATE,
)

# Verify the batch_id_from_query corresponds to an actual insertion event
# and have the batch connected.
if batch_id_from_query:
Expand Down

0 comments on commit cbe01cc

Please sign in to comment.