-
Notifications
You must be signed in to change notification settings - Fork 290
fix(ui): Decrypt TimelineEventKind::UnableToDecrypt
coming from the event cache
#4794
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
fix(ui): Decrypt TimelineEventKind::UnableToDecrypt
coming from the event cache
#4794
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4794 +/- ##
==========================================
+ Coverage 86.36% 86.38% +0.02%
==========================================
Files 291 291
Lines 34379 34374 -5
==========================================
+ Hits 29691 29695 +4
+ Misses 4688 4679 -9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…needs a `&Room`. This patch removes the room `&Room` argument of `TimelineController::retry_event_decryption`. The `TimelineController` already has the room with its `room(&self) -> &Room` method. This method was always used to fetch the room, let's expect `retry_event_decryption` to do that by itself. It also prevents passing the “wrong” room. This is more robust this way.
This patch fixes a bug where events coming from the event cache might be encrypted, see matrix-org#4762 to learn more. This patch updates the `room_event_cache_updates_task` to call `TimelineController::retry_event_decryption` if the origin is `Cache`.
3bada45
to
ddc9345
Compare
m.room.encrypted
coming from the event cacheTimelineEventKind::UnableToDecrypt
coming from the event cache
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, I left some philosophical musings and nits.
This patch adds two tests, ensuring UTD stored in the event cache are decrypted, whether they come from the initial items or paginated items.
75043d4
to
b86b497
Compare
The fix is 3 LOC, the test is 345 LOC, oh yeah.
So, currently, it is possible to store an
TimelineEventKind::UnableToDecrypt
(UTD) event inside the event cache. When received by theTimeline
, prior this patch, such event wasn't decrypted. The fix is actually quite small: everything that comes from the cache (EventsOrigin::Cache
) and that contains a UTD, triggers a redecryption. Hoping that the keys are in theOlmMachine
of course.This patch tests two situations where it can happen: when the UTD is part of the initial items, and when the UTD is part of a pagination. The former was already working, but not tested via the event cache as far as I know, and the latter wasn't tested at all (because it wasn't implemented).