mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 02:33:46 +00:00
Prevented double decryption (#17768)
This commit is contained in:
@@ -2143,15 +2143,19 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
userId: UserId,
|
||||
fullDecryption: boolean = true,
|
||||
): Promise<[CipherViewLike[], CipherView[]]> {
|
||||
if (fullDecryption) {
|
||||
const [decryptedViews, failedViews] = await this.cipherEncryptionService.decryptManyLegacy(
|
||||
ciphers,
|
||||
userId,
|
||||
);
|
||||
return [decryptedViews.sort(this.getLocaleSortingFunction()), failedViews];
|
||||
}
|
||||
|
||||
const [decrypted, failures] = await this.cipherEncryptionService.decryptManyWithFailures(
|
||||
ciphers,
|
||||
userId,
|
||||
);
|
||||
|
||||
const decryptedViews = fullDecryption
|
||||
? await Promise.all(decrypted.map((c) => this.getFullCipherView(c)))
|
||||
: decrypted;
|
||||
|
||||
const failedViews = failures.map((c) => {
|
||||
const cipher_view = new CipherView(c);
|
||||
cipher_view.name = "[error: cannot decrypt]";
|
||||
@@ -2159,7 +2163,7 @@ export class CipherService implements CipherServiceAbstraction {
|
||||
return cipher_view;
|
||||
});
|
||||
|
||||
return [decryptedViews.sort(this.getLocaleSortingFunction()), failedViews];
|
||||
return [decrypted.sort(this.getLocaleSortingFunction()), failedViews];
|
||||
}
|
||||
|
||||
/** Fetches the full `CipherView` when a `CipherListView` is passed. */
|
||||
|
||||
Reference in New Issue
Block a user