-
Notifications
You must be signed in to change notification settings - Fork 314
feat(sdk): Add a tasks that listens for historic room keys if they arrive out of order #5322
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
base: main
Are you sure you want to change the base?
Conversation
…rive out of order Historic room key bundles are uploaded as an encrypted file to the media repo and the key to decrypt the file is sent as a to-device message to the recipient device. In the nominal case, the invite and this to-device message should arrive at the same time and accepting the invite would download and import the bundle. If the to-device message arrives after the invite has already been accepted we would never download and import the bundle. To mitigate this problem, this patch introduces a task that listens for bundles that arrive. If the bundle is for a room that we have joined we will consider importing the bundle.
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #5322 +/- ##
=======================================
Coverage 88.76% 88.77%
=======================================
Files 333 333
Lines 90228 90280 +52
Branches 90228 90280 +52
=======================================
+ Hits 80093 80147 +54
+ Misses 6309 6305 -4
- Partials 3826 3828 +2 ☔ View full report in Codecov by Sentry. |
f258ada
to
bc5afce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far - some small questions inline.
#[instrument(skip(room), fields(room_id = %room.room_id()))] | ||
async fn handle_bundle(room: &Room, bundle_info: &RoomKeyBundleInfo) { | ||
if Self::should_accept_bundle(room, bundle_info) { | ||
info!("Accepting an out of order key bundle."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really "out of order", right? More "late-arriving".
…they arrive out of order
I think we'll want to rebase this on top of #5333. We should at least restrict this behavior to accept such bundles only if the user explicitly accepted the invite, so the homeserver can't join you into a room. |
Historic room key bundles are uploaded as an encrypted file to the media repo and the key to decrypt the file is sent as a to-device message to the recipient device.
In the nominal case, the invite and this to-device message should arrive at the same time and accepting the invite would download and import the bundle. If the to-device message arrives after the invite has already been accepted we would never download and import the bundle.
To mitigate this problem, this patch introduces a task that listens for bundles that arrive. If the bundle is for a room that we have joined we will consider importing the bundle.
Note: that the acceptance rules aren't yet decided and this PR needs to be updated with some better acceptance rules before it gets merged.
This closes: #4926.