[PM-33952] Fix cipher key encryption logic when editing ciphers (#19695)

This commit is contained in:
Nik Gilmore 2026-03-30 15:23:17 -07:00 committed by GitHub
parent 6980030a36
commit ab088536bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -321,8 +321,8 @@ export class CipherService implements CipherServiceAbstraction {
if (
// prevent unprivileged users from migrating to cipher key encryption
(model.viewPassword || originalCipher?.key) &&
(await this.getCipherKeyEncryptionEnabled())
(model.viewPassword && (await this.getCipherKeyEncryptionEnabled())) ||
originalCipher?.key
) {
cipher.key = originalCipher?.key ?? null;
const userOrOrgKey = await this.getKeyForCipherKeyDecryption(cipher, userId);