Track users when joining encrypted rooms#251
Merged
turt2live merged 3 commits intoturt2live:mainfrom Sep 21, 2022
Merged
Conversation
Users are only tracked when the bot user is already in the room when encryption is enabled or if the member status of the user changes in an already encrypted room. This leads to megolm sessions which don't include all devices when a bot joins an encrypted room and existing users can't decrypt messages by the bot. Before this change, only in rooms created by the bot could all other users decrypt messages from the bot. Now already present users will also be tracked and receive the session keys. Signed-off-by: Fabian Möller <fabianm88@gmail.com>
turt2live
approved these changes
Aug 3, 2022
Owner
turt2live
left a comment
There was a problem hiding this comment.
this looks good, though if I can get tests added then that would be most appreciated :)
Contributor
Author
|
While working on the tests for this, I noticed another error related to user tracking: #254 I will update this PR once the other issue is fixed. |
turt2live
approved these changes
Sep 21, 2022
Owner
turt2live
left a comment
There was a problem hiding this comment.
Thanks for the PR! I've adjusted the logic slightly to avoid over-tracking users, but generally this seems sane to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users are only tracked when the bot user is already in the room when encryption is enabled or if the member status of the user changes in an already encrypted room.
This leads to megolm sessions which don't include all devices when a bot joins an encrypted room and existing users can't decrypt messages by the bot.
Before this change, only in rooms created by the bot could all other users decrypt messages from the bot.
Now already present users will also be tracked and receive the session keys.
A simple appservice reproducing the error, which is based on the
encryption_appservice.tsexample, can be found here (also contains docker-compose file for synapse and co):https://github.com/B4dM4n/hookkshot-e2ee-test/blob/main/enctest/src/index.ts
Steps to reproduce:
@encbot:localto encrypted DM/room (inviting user is not tracked by the bot)!pingto bot -> unable to decrypt error!inviteto bot and join room (invited user is now tracked)!pingto room ->Pongcan be decryptedChecklist