From 562e22874512894a2a8c2f79d805508ca7ac83bd Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Mon, 18 Sep 2023 14:15:12 +0200 Subject: [PATCH] [PM-3970] Empty list of ciphers when logging in via fido 2 popout (#6321) * fix: sync not being properly called * fix: don't call sync everywhere --- .../fido2/fido2-authenticator.service.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/libs/common/src/vault/services/fido2/fido2-authenticator.service.ts b/libs/common/src/vault/services/fido2/fido2-authenticator.service.ts index e322bf7e752..a908542a65d 100644 --- a/libs/common/src/vault/services/fido2/fido2-authenticator.service.ts +++ b/libs/common/src/vault/services/fido2/fido2-authenticator.service.ts @@ -84,6 +84,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr } await userInterfaceSession.ensureUnlockedVault(); + await this.syncService.fullSync(false); const existingCipherIds = await this.findExcludedCredentials( params.excludeCredentialDescriptorList @@ -194,6 +195,8 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr let cipherOptions: CipherView[]; await userInterfaceSession.ensureUnlockedVault(); + await this.syncService.fullSync(false); + if (params.allowCredentialDescriptorList?.length > 0) { cipherOptions = await this.findCredentialsById( params.allowCredentialDescriptorList, @@ -296,11 +299,6 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr return []; } - //ensure full sync has completed before getting the ciphers - if ((await this.syncService.getLastSync()) == null) { - await this.syncService.fullSync(false); - } - const ciphers = await this.cipherService.getAllDecrypted(); return ciphers .filter( @@ -331,11 +329,6 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr return []; } - //ensure full sync has completed before getting the ciphers - if ((await this.syncService.getLastSync()) == null) { - await this.syncService.fullSync(false); - } - const ciphers = await this.cipherService.getAllDecrypted(); return ciphers.filter( (cipher) => @@ -348,11 +341,6 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr } private async findCredentialsByRp(rpId: string): Promise { - //ensure full sync has completed before getting the ciphers - if ((await this.syncService.getLastSync()) == null) { - await this.syncService.fullSync(false); - } - const ciphers = await this.cipherService.getAllDecrypted(); return ciphers.filter( (cipher) =>