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

Commit

Permalink
Raise error if prev_ids is not a list
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Bordum Hansen <carl@bordum.dk>
  • Loading branch information
carlbordum committed May 23, 2022
1 parent 39dee30 commit 5e8e88b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog.d/12829.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed a bug where device list updates over federation would fail if they
were not a list. Contributed by Carl Bordum Hansen.
2 changes: 2 additions & 0 deletions synapse/handlers/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ async def incoming_device_list_update(
device_id = edu_content.pop("device_id")
stream_id = str(edu_content.pop("stream_id")) # They may come as ints
prev_ids = edu_content.pop("prev_id", [])
if not isinstance(prev_ids, list):
raise SynapseError(400, "Device list update had an invalid 'prev_ids' field")
prev_ids = [str(p) for p in prev_ids] # They may come as ints

if get_domain_from_id(user_id) != origin:
Expand Down

0 comments on commit 5e8e88b

Please sign in to comment.