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

Commit 5e8e88b

Browse files
committed
Raise error if prev_ids is not a list
Signed-off-by: Carl Bordum Hansen <carl@bordum.dk>
1 parent 39dee30 commit 5e8e88b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

changelog.d/12829.bugfix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed a bug where device list updates over federation would fail if they
2+
were not a list. Contributed by Carl Bordum Hansen.

synapse/handlers/device.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ async def incoming_device_list_update(
763763
device_id = edu_content.pop("device_id")
764764
stream_id = str(edu_content.pop("stream_id")) # They may come as ints
765765
prev_ids = edu_content.pop("prev_id", [])
766+
if not isinstance(prev_ids, list):
767+
raise SynapseError(400, "Device list update had an invalid 'prev_ids' field")
766768
prev_ids = [str(p) for p in prev_ids] # They may come as ints
767769

768770
if get_domain_from_id(user_id) != origin:

0 commit comments

Comments
 (0)