mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Only setdefault for signatures if device has key_json (#7177)
This commit is contained in:
parent
0a7b0882c1
commit
b994e86e35
1
changelog.d/7177.bugfix
Normal file
1
changelog.d/7177.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix a bug which could cause outbound federation traffic to stop working if a client uploaded an incorrect e2e device signature.
|
@ -286,14 +286,16 @@ class DeviceWorkerStore(SQLBaseStore):
|
|||||||
key_json = device.get("key_json", None)
|
key_json = device.get("key_json", None)
|
||||||
if key_json:
|
if key_json:
|
||||||
result["keys"] = db_to_json(key_json)
|
result["keys"] = db_to_json(key_json)
|
||||||
|
|
||||||
|
if "signatures" in device:
|
||||||
|
for sig_user_id, sigs in device["signatures"].items():
|
||||||
|
result["keys"].setdefault("signatures", {}).setdefault(
|
||||||
|
sig_user_id, {}
|
||||||
|
).update(sigs)
|
||||||
|
|
||||||
device_display_name = device.get("device_display_name", None)
|
device_display_name = device.get("device_display_name", None)
|
||||||
if device_display_name:
|
if device_display_name:
|
||||||
result["device_display_name"] = device_display_name
|
result["device_display_name"] = device_display_name
|
||||||
if "signatures" in device:
|
|
||||||
for sig_user_id, sigs in device["signatures"].items():
|
|
||||||
result["keys"].setdefault("signatures", {}).setdefault(
|
|
||||||
sig_user_id, {}
|
|
||||||
).update(sigs)
|
|
||||||
else:
|
else:
|
||||||
result["deleted"] = True
|
result["deleted"] = True
|
||||||
|
|
||||||
@ -494,14 +496,16 @@ class DeviceWorkerStore(SQLBaseStore):
|
|||||||
key_json = device.get("key_json", None)
|
key_json = device.get("key_json", None)
|
||||||
if key_json:
|
if key_json:
|
||||||
result["keys"] = db_to_json(key_json)
|
result["keys"] = db_to_json(key_json)
|
||||||
|
|
||||||
|
if "signatures" in device:
|
||||||
|
for sig_user_id, sigs in device["signatures"].items():
|
||||||
|
result["keys"].setdefault("signatures", {}).setdefault(
|
||||||
|
sig_user_id, {}
|
||||||
|
).update(sigs)
|
||||||
|
|
||||||
device_display_name = device.get("device_display_name", None)
|
device_display_name = device.get("device_display_name", None)
|
||||||
if device_display_name:
|
if device_display_name:
|
||||||
result["device_display_name"] = device_display_name
|
result["device_display_name"] = device_display_name
|
||||||
if "signatures" in device:
|
|
||||||
for sig_user_id, sigs in device["signatures"].items():
|
|
||||||
result["keys"].setdefault("signatures", {}).setdefault(
|
|
||||||
sig_user_id, {}
|
|
||||||
).update(sigs)
|
|
||||||
|
|
||||||
results.append(result)
|
results.append(result)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user