mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
Fix cipher key decryption in TS code (#17907)
This commit is contained in:
@@ -155,7 +155,7 @@ export class Cipher extends Domain implements Decryptable<CipherView> {
|
|||||||
if (this.login != null) {
|
if (this.login != null) {
|
||||||
model.login = await this.login.decrypt(
|
model.login = await this.login.decrypt(
|
||||||
bypassValidation,
|
bypassValidation,
|
||||||
userKeyOrOrgKey,
|
cipherDecryptionKey,
|
||||||
`Cipher Id: ${this.id}`,
|
`Cipher Id: ${this.id}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -167,17 +167,20 @@ export class Cipher extends Domain implements Decryptable<CipherView> {
|
|||||||
break;
|
break;
|
||||||
case CipherType.Card:
|
case CipherType.Card:
|
||||||
if (this.card != null) {
|
if (this.card != null) {
|
||||||
model.card = await this.card.decrypt(userKeyOrOrgKey, `Cipher Id: ${this.id}`);
|
model.card = await this.card.decrypt(cipherDecryptionKey, `Cipher Id: ${this.id}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CipherType.Identity:
|
case CipherType.Identity:
|
||||||
if (this.identity != null) {
|
if (this.identity != null) {
|
||||||
model.identity = await this.identity.decrypt(userKeyOrOrgKey, `Cipher Id: ${this.id}`);
|
model.identity = await this.identity.decrypt(
|
||||||
|
cipherDecryptionKey,
|
||||||
|
`Cipher Id: ${this.id}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CipherType.SshKey:
|
case CipherType.SshKey:
|
||||||
if (this.sshKey != null) {
|
if (this.sshKey != null) {
|
||||||
model.sshKey = await this.sshKey.decrypt(userKeyOrOrgKey, `Cipher Id: ${this.id}`);
|
model.sshKey = await this.sshKey.decrypt(cipherDecryptionKey, `Cipher Id: ${this.id}`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -188,7 +191,7 @@ export class Cipher extends Domain implements Decryptable<CipherView> {
|
|||||||
const attachments: AttachmentView[] = [];
|
const attachments: AttachmentView[] = [];
|
||||||
for (const attachment of this.attachments) {
|
for (const attachment of this.attachments) {
|
||||||
const decryptedAttachment = await attachment.decrypt(
|
const decryptedAttachment = await attachment.decrypt(
|
||||||
userKeyOrOrgKey,
|
cipherDecryptionKey,
|
||||||
`Cipher Id: ${this.id}`,
|
`Cipher Id: ${this.id}`,
|
||||||
);
|
);
|
||||||
attachments.push(decryptedAttachment);
|
attachments.push(decryptedAttachment);
|
||||||
@@ -199,7 +202,7 @@ export class Cipher extends Domain implements Decryptable<CipherView> {
|
|||||||
if (this.fields != null && this.fields.length > 0) {
|
if (this.fields != null && this.fields.length > 0) {
|
||||||
const fields: FieldView[] = [];
|
const fields: FieldView[] = [];
|
||||||
for (const field of this.fields) {
|
for (const field of this.fields) {
|
||||||
const decryptedField = await field.decrypt(userKeyOrOrgKey);
|
const decryptedField = await field.decrypt(cipherDecryptionKey);
|
||||||
fields.push(decryptedField);
|
fields.push(decryptedField);
|
||||||
}
|
}
|
||||||
model.fields = fields;
|
model.fields = fields;
|
||||||
@@ -208,7 +211,7 @@ export class Cipher extends Domain implements Decryptable<CipherView> {
|
|||||||
if (this.passwordHistory != null && this.passwordHistory.length > 0) {
|
if (this.passwordHistory != null && this.passwordHistory.length > 0) {
|
||||||
const passwordHistory: PasswordHistoryView[] = [];
|
const passwordHistory: PasswordHistoryView[] = [];
|
||||||
for (const ph of this.passwordHistory) {
|
for (const ph of this.passwordHistory) {
|
||||||
const decryptedPh = await ph.decrypt(userKeyOrOrgKey);
|
const decryptedPh = await ph.decrypt(cipherDecryptionKey);
|
||||||
passwordHistory.push(decryptedPh);
|
passwordHistory.push(decryptedPh);
|
||||||
}
|
}
|
||||||
model.passwordHistory = passwordHistory;
|
model.passwordHistory = passwordHistory;
|
||||||
|
|||||||
Reference in New Issue
Block a user