diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2020-03-09 09:54:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 09:54:48 +0000 |
commit | bbf725e7da6b1944318bba2664cc0c3b721572be (patch) | |
tree | 9218a833396bb1ac125a1de4754489d89a623e7f | |
parent | Add type hints to logging/context.py (#6309) (diff) | |
parent | Lint (diff) | |
download | synapse-bbf725e7da6b1944318bba2664cc0c3b721572be.tar.xz |
Merge pull request #7045 from matrix-org/babolivier/room_keys_check
Make sure that is_verified is a boolean when processing room keys
-rw-r--r-- | changelog.d/7045.misc | 1 | ||||
-rw-r--r-- | synapse/handlers/e2e_room_keys.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/changelog.d/7045.misc b/changelog.d/7045.misc new file mode 100644 index 0000000000..74c1abea56 --- /dev/null +++ b/changelog.d/7045.misc @@ -0,0 +1 @@ +Add a type check to `is_verified` when processing room keys. diff --git a/synapse/handlers/e2e_room_keys.py b/synapse/handlers/e2e_room_keys.py index f1b4424a02..9abaf13b8f 100644 --- a/synapse/handlers/e2e_room_keys.py +++ b/synapse/handlers/e2e_room_keys.py @@ -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", |