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

Commit 12aa5a7

Browse files
Ensure is_verified on /_matrix/client/r0/room_keys/keys is a boolean (#7150)
1 parent fbf0782 commit 12aa5a7

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

changelog.d/7150.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure `is_verified` is a boolean in responses to `GET /_matrix/client/r0/room_keys/keys`. Also warn the user if they forgot the `version` query param.

synapse/rest/client/v2_alpha/room_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async def on_GET(self, request, room_id, session_id):
188188
"""
189189
requester = await self.auth.get_user_by_req(request, allow_guest=False)
190190
user_id = requester.user.to_string()
191-
version = parse_string(request, "version")
191+
version = parse_string(request, "version", required=True)
192192

193193
room_keys = await self.e2e_room_keys_handler.get_room_keys(
194194
user_id, version, room_id, session_id

synapse/storage/data_stores/main/e2e_room_keys.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ def get_e2e_room_keys(self, user_id, version, room_id=None, session_id=None):
146146
room_entry["sessions"][row["session_id"]] = {
147147
"first_message_index": row["first_message_index"],
148148
"forwarded_count": row["forwarded_count"],
149-
"is_verified": row["is_verified"],
149+
# is_verified must be returned to the client as a boolean
150+
"is_verified": bool(row["is_verified"]),
150151
"session_data": json.loads(row["session_data"]),
151152
}
152153

0 commit comments

Comments
 (0)