summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-24 14:24:42 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-24 14:24:42 +0000
commitc19705f4c99e4ff7d76622b10d956c370f738e18 (patch)
tree817e68016e036a1f62a3bfe0ab3859d26ca8e995 /synapse/handlers
parentAdd type hints to logging/context.py (#6309) (diff)
parentMerge pull request #7045 from matrix-org/babolivier/room_keys_check (diff)
downloadsynapse-c19705f4c99e4ff7d76622b10d956c370f738e18.tar.xz
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
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/e2e_room_keys.py7
1 files changed, 7 insertions, 0 deletions
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",