Skip to content

Commit

Permalink
fix: Allow any user in e2ee room to create and propagate room keys (#…
Browse files Browse the repository at this point in the history
…34152)

Co-authored-by: Kevin Aleman <[email protected]>
  • Loading branch information
dionisio-bot[bot] and KevLehman authored Dec 9, 2024
1 parent d4c275c commit f36e2ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-pants-hunt.md
Original file line number Diff line number Diff line change
@@ -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
24 changes: 7 additions & 17 deletions apps/meteor/app/e2e/client/rocketchat.e2e.room.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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');
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down

0 comments on commit f36e2ab

Please sign in to comment.