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
  • Loading branch information
KevLehman authored Dec 6, 2024
1 parent 211c10d commit d569f26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 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
12 changes: 1 addition & 11 deletions apps/meteor/app/e2e/client/rocketchat.e2e.room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ export class E2ERoom extends Emitter {

try {
const room = Rooms.findOne({ _id: this.roomId })!;

Check warning on line 328 in apps/meteor/app/e2e/client/rocketchat.e2e.room.ts

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Forbidden non-null assertion
// 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 @@ -343,15 +342,6 @@ export class E2ERoom extends Emitter {
}
}

userShouldCreateKeys(room: any) {
// 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: any) {
return roomCoordinator.getRoomDirectives(type).allowRoomSettingChange({}, RoomSettingsEnum.E2E);
}
Expand Down

0 comments on commit d569f26

Please sign in to comment.