diff --git a/libs/common/src/vault/abstractions/cipher.service.ts b/libs/common/src/vault/abstractions/cipher.service.ts index 7eb2d4b0656..7971b6d4658 100644 --- a/libs/common/src/vault/abstractions/cipher.service.ts +++ b/libs/common/src/vault/abstractions/cipher.service.ts @@ -257,6 +257,10 @@ export abstract class CipherService implements UserKeyRotationDataProvider; /** diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index f6e12e71edd..2ad4274c235 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -1544,11 +1544,13 @@ export class CipherService implements CipherServiceAbstraction { return encryptedCiphers; } + /** @inheritdoc */ async getDecryptedAttachmentBuffer( cipherId: CipherId, attachment: AttachmentView, response: Response, userId: UserId, + useLegacyDecryption?: boolean, ): Promise { const useSdkDecryption = await this.configService.getFeatureFlag( FeatureFlag.PM19941MigrateCipherDomainToSdk, @@ -1558,7 +1560,7 @@ export class CipherService implements CipherServiceAbstraction { this.ciphers$(userId).pipe(map((ciphersData) => new Cipher(ciphersData[cipherId]))), ); - if (useSdkDecryption) { + if (useSdkDecryption && !useLegacyDecryption) { const encryptedContent = await response.arrayBuffer(); return this.cipherEncryptionService.decryptAttachmentContent( cipherDomain, diff --git a/libs/vault/src/components/download-attachment/download-attachment.component.ts b/libs/vault/src/components/download-attachment/download-attachment.component.ts index 627ffafc6b2..8208887b888 100644 --- a/libs/vault/src/components/download-attachment/download-attachment.component.ts +++ b/libs/vault/src/components/download-attachment/download-attachment.component.ts @@ -92,6 +92,9 @@ export class DownloadAttachmentComponent { this.attachment, response, userId, + // When the emergency access ID is present, the cipher is being viewed via emergency access. + // Force legacy decryption in these cases. + this.emergencyAccessId ? true : false, ); this.fileDownloadService.download({