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

Commit 774ac49

Browse files
authored
Make sure prev_ids defaults to empty list (#12829)
Signed-off-by: Carl Bordum Hansen <[email protected]>
1 parent 2989115 commit 774ac49

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

changelog.d/12829.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug where we did not correctly handle invalid device list updates over federation. 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)