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

Commit c19705f

Browse files
committed
Merge pull request #7045 from matrix-org/babolivier/room_keys_check
* commit 'bbf725e7d': Lint Mention the session ID in the error message Lint Changelog Make sure that is_verified is a boolean when processing room keys
2 parents 942f048 + bbf725e commit c19705f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

changelog.d/7045.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a type check to `is_verified` when processing room keys.

synapse/handlers/e2e_room_keys.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ def upload_room_keys(self, user_id, version, room_keys):
207207
changed = False # if anything has changed, we need to update the etag
208208
for room_id, room in iteritems(room_keys["rooms"]):
209209
for session_id, room_key in iteritems(room["sessions"]):
210+
if not isinstance(room_key["is_verified"], bool):
211+
msg = (
212+
"is_verified must be a boolean in keys for session %s in"
213+
"room %s" % (session_id, room_id)
214+
)
215+
raise SynapseError(400, msg, Codes.INVALID_PARAM)
216+
210217
log_kv(
211218
{
212219
"message": "Trying to upload room key",

0 commit comments

Comments
 (0)