mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +01:00
Fix key rotation being broken due to org ciphers being included (#10140)
This commit is contained in:
parent
e27d698d4b
commit
fd93c76c0d
@ -352,8 +352,10 @@ describe("Cipher Service", () => {
|
|||||||
|
|
||||||
const cipher1 = new CipherView(cipherObj);
|
const cipher1 = new CipherView(cipherObj);
|
||||||
cipher1.id = "Cipher 1";
|
cipher1.id = "Cipher 1";
|
||||||
|
cipher1.organizationId = null;
|
||||||
const cipher2 = new CipherView(cipherObj);
|
const cipher2 = new CipherView(cipherObj);
|
||||||
cipher2.id = "Cipher 2";
|
cipher2.id = "Cipher 2";
|
||||||
|
cipher2.organizationId = null;
|
||||||
|
|
||||||
decryptedCiphers = new BehaviorSubject({
|
decryptedCiphers = new BehaviorSubject({
|
||||||
Cipher1: cipher1,
|
Cipher1: cipher1,
|
||||||
|
@ -1184,11 +1184,16 @@ export class CipherService implements CipherServiceAbstraction {
|
|||||||
let encryptedCiphers: CipherWithIdRequest[] = [];
|
let encryptedCiphers: CipherWithIdRequest[] = [];
|
||||||
|
|
||||||
const ciphers = await this.getAllDecrypted();
|
const ciphers = await this.getAllDecrypted();
|
||||||
if (!ciphers || ciphers.length === 0) {
|
if (!ciphers) {
|
||||||
|
return encryptedCiphers;
|
||||||
|
}
|
||||||
|
|
||||||
|
const userCiphers = ciphers.filter((c) => c.organizationId == null);
|
||||||
|
if (userCiphers.length === 0) {
|
||||||
return encryptedCiphers;
|
return encryptedCiphers;
|
||||||
}
|
}
|
||||||
encryptedCiphers = await Promise.all(
|
encryptedCiphers = await Promise.all(
|
||||||
ciphers.map(async (cipher) => {
|
userCiphers.map(async (cipher) => {
|
||||||
const encryptedCipher = await this.encrypt(cipher, newUserKey, originalUserKey);
|
const encryptedCipher = await this.encrypt(cipher, newUserKey, originalUserKey);
|
||||||
return new CipherWithIdRequest(encryptedCipher);
|
return new CipherWithIdRequest(encryptedCipher);
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user