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

Commit

Permalink
Ensure is_verified on /_matrix/client/r0/room_keys/keys is a boolean (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 authored Mar 27, 2020
1 parent fbf0782 commit 12aa5a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
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

0 comments on commit 12aa5a7

Please sign in to comment.