From c8bc7c62e9f2b77977dc0a15498821232206878a Mon Sep 17 00:00:00 2001 From: Jake Fink Date: Thu, 2 Nov 2023 18:17:47 -0400 Subject: [PATCH] [PM-4660] return early from cipher decryption if no encryption key (#6774) * return early from cipher decryption if no key * add comment --- libs/common/src/vault/services/cipher.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index b5090a14883..ae486302e59 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -293,6 +293,10 @@ export class CipherService implements CipherServiceAbstraction { const ciphers = await this.getAll(); const orgKeys = await this.cryptoService.getOrgKeys(); const userKey = await this.cryptoService.getUserKeyWithLegacySupport(); + if (orgKeys == null && userKey == null) { + // return early if there are no keys to decrypt with + return; + } // Group ciphers by orgId or under 'null' for the user's ciphers const grouped = ciphers.reduce((agg, c) => {