diff --git a/.changeset/chilly-pants-hunt.md b/.changeset/chilly-pants-hunt.md new file mode 100644 index 000000000000..0127ae7e174f --- /dev/null +++ b/.changeset/chilly-pants-hunt.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Removes a validation that allowed only the room creator to propagate E2EE room keys. This was causing issues when the rooms were created via apps or some other integration, as the creator may not be online or able to create E2EE keys diff --git a/apps/meteor/app/e2e/client/rocketchat.e2e.room.js b/apps/meteor/app/e2e/client/rocketchat.e2e.room.js index 4c9de837dce0..8f4fe1c275d7 100644 --- a/apps/meteor/app/e2e/client/rocketchat.e2e.room.js +++ b/apps/meteor/app/e2e/client/rocketchat.e2e.room.js @@ -2,12 +2,6 @@ import { Base64 } from '@rocket.chat/base64'; import { Emitter } from '@rocket.chat/emitter'; import EJSON from 'ejson'; -import { RoomManager } from '../../../client/lib/RoomManager'; -import { roomCoordinator } from '../../../client/lib/rooms/roomCoordinator'; -import { RoomSettingsEnum } from '../../../definition/IRoomTypeConfig'; -import { ChatRoom, Subscriptions, Messages } from '../../models/client'; -import { sdk } from '../../utils/client/lib/SDKClient'; -import { t } from '../../utils/lib/i18n'; import { E2ERoomState } from './E2ERoomState'; import { toString, @@ -30,6 +24,12 @@ import { } from './helper'; import { log, logError } from './logger'; import { e2e } from './rocketchat.e2e'; +import { RoomManager } from '../../../client/lib/RoomManager'; +import { roomCoordinator } from '../../../client/lib/rooms/roomCoordinator'; +import { RoomSettingsEnum } from '../../../definition/IRoomTypeConfig'; +import { ChatRoom, Subscriptions, Messages } from '../../models/client'; +import { sdk } from '../../utils/client/lib/SDKClient'; +import { t } from '../../utils/lib/i18n'; const KEY_ID = Symbol('keyID'); const PAUSED = Symbol('PAUSED'); @@ -308,8 +308,7 @@ export class E2ERoom extends Emitter { try { const room = ChatRoom.findOne({ _id: this.roomId }); - // Only room creator can set keys for room - if (!room.e2eKeyId && this.userShouldCreateKeys(room)) { + if (!room.e2eKeyId) { this.setState(E2ERoomState.CREATING_KEYS); await this.createGroupKey(); this.setState(E2ERoomState.READY); @@ -325,15 +324,6 @@ export class E2ERoom extends Emitter { } } - userShouldCreateKeys(room) { - // On DMs, we'll allow any user to set the keys - if (room.t === 'd') { - return true; - } - - return room.u._id === this.userId; - } - isSupportedRoomType(type) { return roomCoordinator.getRoomDirectives(type).allowRoomSettingChange({}, RoomSettingsEnum.E2E); }