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

Commit 87a686b

Browse files
committed
Raise error if prev_ids is not a list
Signed-off-by: Carl Bordum Hansen <[email protected]>
1 parent 39dee30 commit 87a686b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

changelog.d/12829.bugfix

+2
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

+4
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,10 @@ 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(
768+
400, "Device list update had an invalid 'prev_ids' field"
769+
)
766770
prev_ids = [str(p) for p in prev_ids] # They may come as ints
767771

768772
if get_domain_from_id(user_id) != origin:

0 commit comments

Comments
 (0)