Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a more structured algorithm for determining decryption client for appservice events #352

Open
wants to merge 103 commits into
base: main
Choose a base branch
from

Conversation

Half-Shot
Copy link
Contributor

@Half-Shot Half-Shot commented Nov 28, 2023

This PR changes the way we pick a client for decrypting an event, and caches the result so that it can be reused. This is intended to ensure that when the sender user isn't used for decryption, Appservice doesn't make repeated calls to get_joined_rooms, and when it picks a client it prefers one with encryption already enabled to save time.

We also update to ES2022 so I can use Error.cause, one of my favourite new ES features.

Checklist

  • Tests written for all new code
  • Linter has been satisfied
  • Sign-off given on the changes (see CONTRIBUTING.md)

AndrewFerr and others added 30 commits December 8, 2022 21:34
Ensure that the bot has all keys needed for sharing a room key with
recipients before encryping an event in that room.

Signed-off-by: Andrew Ferrazzutti <[email protected]>
* Handle pre-shared invite keys

Signed-off-by: Andrew Ferrazzutti <[email protected]>

* Use assignment for changes to membership array

* Catch member lookup errors in prepareEncrypt

Treat an error in looking up room members of a particular membership
type as there being no members of that type.

Return early if no members are found.

* Resolve conflict on `members` variable

Signed-off-by: Andrew Ferrazzutti <[email protected]>
We'd like to disable the LRU to tempoarily workaround some caching issues, which requires us to be able to set the values of maxAgeMs/maxCached to `0`.
We'd like to disable the LRU to tempoarily workaround some caching
issues, which requires us to be able to set the values of
maxAgeMs/maxCached to `0`.
Includes v0.6.4+patches (not yet released as v0.6.5 upstream)
…e#314)

* Fix key query and claim APIs to support async functionality

* fix copy/paste fail
Signed-off-by: Andrew Ferrazzutti <[email protected]>
Signed-off-by: Andrew Ferrazzutti <[email protected]>
Signed-off-by: Andrew Ferrazzutti <[email protected]>
Run all tests with both the Sled and SQLite store types

Signed-off-by: Andrew Ferrazzutti <[email protected]>
Signed-off-by: Andrew Ferrazzutti <[email protected]>
Signed-off-by: Andrew Ferrazzutti <[email protected]>
AndrewFerr and others added 19 commits September 6, 2023 09:50
This also allows it to be guarded with a check on whether the client's
crypto had been set up.
This allows responding to when a transaction requires an appservice user
that the process has not yet initialized.
because:
- the failure will print its own logs
- the point of catching this is that it's _not_ an error
because the failure already logs the error
If key backups are enabled on a client that already has them enabled,
don't re-add the listener for to-device room key messages.
Otherwise, if a listener of that event were to trigger a lookup of the
same Intent, the lookup wouldn't see the event in the Intent cache, and
thus cause a new Intent to be created & new event to be emitted.
@turt2live turt2live self-requested a review November 28, 2023 15:30
Copy link
Owner

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems to have gone wrong with the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants