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

Ensure is_verified on /_matrix/client/r0/room_keys/keys is a boolean #7150

Merged
merged 5 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7150.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +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.
2 changes: 1 addition & 1 deletion synapse/rest/client/v2_alpha/room_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async def on_GET(self, request, room_id, session_id):
"""
requester = await self.auth.get_user_by_req(request, allow_guest=False)
user_id = requester.user.to_string()
version = parse_string(request, "version")
version = parse_string(request, "version", required=True)

room_keys = await self.e2e_room_keys_handler.get_room_keys(
user_id, version, room_id, session_id
Expand Down
3 changes: 2 additions & 1 deletion synapse/storage/data_stores/main/e2e_room_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def get_e2e_room_keys(self, user_id, version, room_id=None, session_id=None):
room_entry["sessions"][row["session_id"]] = {
"first_message_index": row["first_message_index"],
"forwarded_count": row["forwarded_count"],
"is_verified": row["is_verified"],
# is_verified must be returned to the client as a boolean
"is_verified": bool(row["is_verified"]),
"session_data": json.loads(row["session_data"]),
}

Expand Down