Verify ?chunk_id actually corresponds to an insertion event that exists (MSC2716) (#10776)

This commit is contained in:
Eric Eastwood 2021-09-15 03:34:30 -05:00 committed by GitHub
parent 1c555527b3
commit 145c006ef7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 1 deletions

View file

@ -300,7 +300,18 @@ class RoomBatchSendEventRestServlet(RestServlet):
# event, which causes the HS to ask for the state at the start of
# the chunk later.
prev_event_ids = [fake_prev_event_id]
# TODO: Verify the chunk_id_from_query corresponds to an insertion event
# Verify the chunk_id_from_query corresponds to an actual insertion event
# and have the chunk connected.
corresponding_insertion_event_id = (
await self.store.get_insertion_event_by_chunk_id(chunk_id_from_query)
)
if corresponding_insertion_event_id is None:
raise SynapseError(
400,
"No insertion event corresponds to the given ?chunk_id",
errcode=Codes.INVALID_PARAM,
)
pass
# Otherwise, create an insertion event to act as a starting point.
#