1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-11 22:13:32 +00:00

catch failed cipher key decryption and return early

This commit is contained in:
Jake Fink
2024-12-10 17:07:14 -05:00
parent b2af12ab24
commit 4fd1011752

View File

@@ -136,7 +136,12 @@ export class Cipher extends Domain implements Decryptable<CipherView> {
if (this.key != null) {
const encryptService = Utils.getContainerService().getEncryptService();
encKey = new SymmetricCryptoKey(await encryptService.decryptToBytes(this.key, encKey));
const keyBytes = await encryptService.decryptToBytes(this.key, encKey);
if (keyBytes == null) {
model.name = "[error: cannot decrypt]";
return model;
}
encKey = new SymmetricCryptoKey(keyBytes);
bypassValidation = false;
}