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

Make sure that is_verified is a boolean when processing room keys #7045

Merged
merged 5 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7045.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a type check to `is_verified` when processing room keys.
7 changes: 7 additions & 0 deletions synapse/handlers/e2e_room_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ def upload_room_keys(self, user_id, version, room_keys):
changed = False # if anything has changed, we need to update the etag
for room_id, room in iteritems(room_keys["rooms"]):
for session_id, room_key in iteritems(room["sessions"]):
if not isinstance(room_key["is_verified"], bool):
msg = (
"is_verified must be a boolean in keys for session %s in"
"room %s" % (session_id, room_id)
)
raise SynapseError(400, msg, Codes.INVALID_PARAM)

log_kv(
{
"message": "Trying to upload room key",
Expand Down