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

Commit

Permalink
Merge pull request #7045 from matrix-org/babolivier/room_keys_check
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
anoadragon453 committed Mar 24, 2020
2 parents 942f048 + bbf725e commit c19705f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
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

0 comments on commit c19705f

Please sign in to comment.