1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00
This commit is contained in:
Jordan Aasen
2025-03-27 10:46:39 -07:00
committed by GitHub
parent 7d3e43abd8
commit 93a289bfa8
2 changed files with 57 additions and 18 deletions

View File

@@ -222,7 +222,11 @@ export class CipherService implements CipherServiceAbstraction {
cipher.reprompt = model.reprompt;
cipher.edit = model.edit;
if (await this.getCipherKeyEncryptionEnabled()) {
if (
// prevent unprivileged users from migrating to cipher key encryption
(model.viewPassword || originalCipher?.key) &&
(await this.getCipherKeyEncryptionEnabled())
) {
cipher.key = originalCipher?.key ?? null;
const userOrOrgKey = await this.getKeyForCipherKeyDecryption(cipher, userId);
// The keyForEncryption is only used for encrypting the cipher key, not the cipher itself, since cipher key encryption is enabled.