Track users when joining encrypted rooms #251
Merged
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.ts
example, 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:local
to encrypted DM/room (inviting user is not tracked by the bot)!ping
to bot -> unable to decrypt error!invite
to bot and join room (invited user is now tracked)!ping
to room ->Pong
can be decryptedChecklist