diff --git a/.changeset/soft-planets-cross.md b/.changeset/soft-planets-cross.md new file mode 100644 index 0000000000000..fc9b0bdfdacfe --- /dev/null +++ b/.changeset/soft-planets-cross.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": major +--- + +Fixes a behavior of E2EE room creation that allowed any user on the room to define room keys before the room creator, causing race conditions. diff --git a/apps/meteor/app/e2e/client/rocketchat.e2e.room.js b/apps/meteor/app/e2e/client/rocketchat.e2e.room.js index 1b2357067028b..b360e635243d6 100644 --- a/apps/meteor/app/e2e/client/rocketchat.e2e.room.js +++ b/apps/meteor/app/e2e/client/rocketchat.e2e.room.js @@ -245,8 +245,8 @@ export class E2ERoom extends Emitter { try { const room = ChatRoom.findOne({ _id: this.roomId }); - if (!room.e2eKeyId) { - // TODO CHECK_PERMISSION + // Only room creator can set keys for room + if (!room.e2eKeyId && room.u._id === this.userId) { this.setState(E2ERoomState.CREATING_KEYS); await this.createGroupKey(); this.setState(E2ERoomState.READY);