mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-18 16:02:15 +01:00
Make sure prev_ids
defaults to empty list (#12829)
Signed-off-by: Carl Bordum Hansen <carl@bordum.dk>
This commit is contained in:
parent
298911555c
commit
774ac4930d
2 changed files with 5 additions and 0 deletions
1
changelog.d/12829.bugfix
Normal file
1
changelog.d/12829.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix a bug where we did not correctly handle invalid device list updates over federation. Contributed by Carl Bordum Hansen.
|
|
@ -763,6 +763,10 @@ class DeviceListUpdater:
|
||||||
device_id = edu_content.pop("device_id")
|
device_id = edu_content.pop("device_id")
|
||||||
stream_id = str(edu_content.pop("stream_id")) # They may come as ints
|
stream_id = str(edu_content.pop("stream_id")) # They may come as ints
|
||||||
prev_ids = edu_content.pop("prev_id", [])
|
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
|
prev_ids = [str(p) for p in prev_ids] # They may come as ints
|
||||||
|
|
||||||
if get_domain_from_id(user_id) != origin:
|
if get_domain_from_id(user_id) != origin:
|
||||||
|
|
Loading…
Reference in a new issue