fix: do not encrypt messages when workspace E2E is disabled#7324
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🧰 Additional context used📓 Path-based instructions (5)**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx,json}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
app/lib/encryption/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (1)📚 Learning: 2026-04-30T17:07:51.020ZApplied to files:
🔇 Additional comments (2)
WalkthroughThe PR adds a workspace-level ChangesE2E Workspace-Level Encryption Guard
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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 |
Proposed changes
encryptMessageonly checked the per-subscriptionencryptedflag, so a room with a staleencrypted: truevalue on the local subscription would still attempt to encrypt messages even when the workspace-level settingE2E_Enablewas disabled. Since no session key was available,encryptMessagereturnedundefined, which then causedsendMessageCallto crash when destructuring_id, leaving the local message stuck in theTEMPstate (preventing the user from sending messages).This PR aligns mobile behavior with web behavior: when
E2E_Enableisfalseat the workspace level,encryptMessagenow short-circuits and returns the plain message regardless of the local subscription flag.
Added unit tests covering the new branch, as well as the existing
encryptMessagebranches:Issue(s)
https://rocketchat.atlassian.net/browse/SUP-994
How to test or reproduce
Pre-requisites: a workspace where
E2E_Enableis off atadmin settings, and a DM whose local subscription has
encrypted: true(typically a DM that was previously encrypted, or onestamped encrypted server-side).
Before the fix:
After the fix:
{ _id, rid, msg }, not: 'e2e').Screenshots
Types of changes
Checklist
Further comments
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests