[PM-4660] return early from cipher decryption if no encryption key (#6774)

* return early from cipher decryption if no key

* add comment
This commit is contained in:
Jake Fink 2023-11-02 18:17:47 -04:00 committed by GitHub
parent 0a7fcddd5a
commit c8bc7c62e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -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) => {