-
Notifications
You must be signed in to change notification settings - Fork 13k
fix(e2ee): Subscription's lastMessage not properly decrypting
#38283
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: develop
Are you sure you want to change the base?
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
WalkthroughRefactors E2EE decryption paths: Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as "Subscription Caller"
participant Room as "E2E Room"
participant Decrypt as "Decryptor"
participant Log as "Logger"
Caller->>Room: find e2eRoom
alt no e2eRoom
Room->>Log: warn("no e2eRoom found")
Log-->>Caller: return
else e2eRoom found
Room-->>Caller: attach READY listener
Note right of Room: wait for READY
Room->>Caller: emit READY
Caller->>Decrypt: decryptSubscription(e2eRoom)
Decrypt-->>Caller: done
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
No issues found across 2 files
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/meteor/client/lib/e2ee/rocketchat.e2e.ts`:
- Around line 680-683: The READY listener can miss the event if the existing
e2eRoom instance is already initialized; update the logic around
getInstanceByRoomId to check the room's readiness first (e.g., an
isReady/isInitialized property or isReady() method) and if already ready call
e2eRoom.decryptSubscription() immediately, otherwise register
e2eRoom.once('READY', async () => { span.info('e2e room ready'); await
e2eRoom.decryptSubscription(); }); so that decryptSubscription runs in both
cases.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #38283 +/- ##
========================================
Coverage 70.75% 70.75%
========================================
Files 3142 3142
Lines 108927 108939 +12
Branches 19603 19619 +16
========================================
+ Hits 77066 77079 +13
+ Misses 29864 29858 -6
- Partials 1997 2002 +5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Proposed changes (including videos or screenshots)
There were 2 issues identified:
decryptMessagemethod was mutating the original (encrypted) message object, causing subsequent validations to assert that the original (encrypted) messagemsgproperty was the same as the decrypted message'smsgproperty, since both were referencing the same object.decryptSubscriptionwas not waiting for the e2eRoom instance to be in state "ready", causing subscriptions to not be decrypted at all in a few cases, such as after a refresh, or after inserting the e2e password.Issue(s)
CORE-1740
Steps to test or reproduce
Further comments
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.