Merge pull request #7045 from matrix-org/babolivier/room_keys_check

Make sure that is_verified is a boolean when processing room keys
pull/7059/head
Brendan Abolivier 2020-03-09 09:54:48 +00:00 committed by GitHub
commit bbf725e7da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

1
changelog.d/7045.misc Normal file
View File

@ -0,0 +1 @@
Add a type check to `is_verified` when processing room keys.

View File

@ -207,6 +207,13 @@ class E2eRoomKeysHandler(object):
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",