Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-3970] Empty list of ciphers when logging in via fido 2 popout #6321

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LogService } from "../../../platform/abstractions/log.service";

Check notice on line 1 in libs/common/src/vault/services/fido2/fido2-authenticator.service.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (EC-598-beeep-properly-store-passkeys-in-bitwarden)

✅ Getting better: Overall Code Complexity

The mean cyclomatic complexity decreases from 7.36 to 7.09, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
import { Utils } from "../../../platform/misc/utils";
import { CipherService } from "../../abstractions/cipher.service";
import {
Expand Down Expand Up @@ -84,6 +84,7 @@
}

await userInterfaceSession.ensureUnlockedVault();
await this.syncService.fullSync(false);

Check notice on line 87 in libs/common/src/vault/services/fido2/fido2-authenticator.service.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (EC-598-beeep-properly-store-passkeys-in-bitwarden)

ℹ Getting worse: Complex Method

Fido2AuthenticatorService.makeCredential already has high cyclomatic complexity, and now it increases in Lines of Code from 116 to 117. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

const existingCipherIds = await this.findExcludedCredentials(
params.excludeCredentialDescriptorList
Expand Down Expand Up @@ -194,6 +195,8 @@
let cipherOptions: CipherView[];

await userInterfaceSession.ensureUnlockedVault();
await this.syncService.fullSync(false);

Check notice on line 199 in libs/common/src/vault/services/fido2/fido2-authenticator.service.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (EC-598-beeep-properly-store-passkeys-in-bitwarden)

ℹ Getting worse: Complex Method

Fido2AuthenticatorService.getAssertion already has high cyclomatic complexity, and now it increases in Lines of Code from 96 to 97. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
if (params.allowCredentialDescriptorList?.length > 0) {
cipherOptions = await this.findCredentialsById(
params.allowCredentialDescriptorList,
Expand Down Expand Up @@ -296,11 +299,6 @@
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(
Expand Down Expand Up @@ -331,11 +329,6 @@
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) =>
Expand All @@ -348,11 +341,6 @@
}

private async findCredentialsByRp(rpId: string): Promise<CipherView[]> {
//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) =>
Expand Down
Loading