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-17035] Fix biometric unlock badge in mv2 #12854

Merged
merged 22 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4555e95
Fix biometrics not working in firefox or windows
quexten Jan 13, 2025
a7c7497
Remove logs
quexten Jan 13, 2025
c4c6c97
Update badge after biometric unlock
quexten Jan 13, 2025
f7ec68f
Add removal todo note
quexten Jan 13, 2025
4538e76
Merge branch 'main' into km/fix-bio
quexten Jan 13, 2025
48c3fcb
Remove debug logging
quexten Jan 13, 2025
1a6d519
Merge branch 'km/fix-bio' of github.com:bitwarden/clients into km/fixโ€ฆ
quexten Jan 13, 2025
e141a1a
Fix type warnings
quexten Jan 13, 2025
0daad18
Fix userkey typing in background biometrics service
quexten Jan 13, 2025
b230395
Simplify types for userkey in foreground-browser-biometrics and runtiโ€ฆ
quexten Jan 13, 2025
0f44783
Merge branch 'main' into km/fix-bio
quexten Jan 13, 2025
e7fc809
Add process reload logging
quexten Jan 14, 2025
7681357
Fix autoprompt not working when no process reload happened
quexten Jan 14, 2025
90c06f6
Fix biometric unlock badge in mv2
quexten Jan 14, 2025
89fcc85
Fix instant reprompt on firefox lock
quexten Jan 14, 2025
329ef91
Merge branch 'km/fix-autoprompt' into km/fix-badge-mv2
quexten Jan 14, 2025
424b175
Merge branch 'km/fix-bio' into km/fix-autoprompt
quexten Jan 14, 2025
a39bd41
Merge branch 'km/fix-autoprompt' into km/fix-badge-mv2
quexten Jan 14, 2025
71a7f05
Merge branch 'main' into km/fix-badge-mv2
quexten Jan 15, 2025
a8dbc4d
Merge branch 'main' into km/fix-badge-mv2
quexten Jan 15, 2025
6deb347
Remove biometrics autoprompt on firefox (#12856)
quexten Jan 15, 2025
b4b7900
Merge branch 'main' into km/fix-badge-mv2
quexten Jan 15, 2025
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
Expand Up @@ -20,7 +20,7 @@ <h2 bitTypography="h6">{{ "unlockMethods" | i18n }}</h2>
{{ biometricUnavailabilityReason }}
</bit-hint>
</bit-form-control>
<bit-form-control class="tw-pl-5" *ngIf="this.form.value.biometric">
<bit-form-control class="tw-pl-5" *ngIf="this.form.value.biometric && showAutoPrompt">
<input
bitCheckbox
id="autoBiometricsPrompt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
import { DeviceType } from "@bitwarden/common/enums";

Check warning on line 32 in apps/browser/src/auth/popup/settings/account-security.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/auth/popup/settings/account-security.component.ts#L32

Added line #L32 was not covered by tests
import { VaultTimeoutAction } from "@bitwarden/common/enums/vault-timeout-action.enum";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
Expand Down Expand Up @@ -106,6 +107,7 @@
hasVaultTimeoutPolicy = false;
biometricUnavailabilityReason: string;
showChangeMasterPass = true;
showAutoPrompt = true;

Check warning on line 110 in apps/browser/src/auth/popup/settings/account-security.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/auth/popup/settings/account-security.component.ts#L110

Added line #L110 was not covered by tests

form = this.formBuilder.group({
vaultTimeout: [null as VaultTimeout | null],
Expand Down Expand Up @@ -141,6 +143,11 @@
) {}

async ngOnInit() {
// Firefox popup closes when unfocused by biometrics, blocking all unlock methods
if (this.platformUtilsService.getDevice() === DeviceType.FirefoxExtension) {
this.showAutoPrompt = false;

Check warning on line 148 in apps/browser/src/auth/popup/settings/account-security.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/auth/popup/settings/account-security.component.ts#L148

Added line #L148 was not covered by tests
}

const hasMasterPassword = await this.userVerificationService.hasMasterPassword();
this.showMasterPasswordOnClientRestartOption = hasMasterPassword;
const maximumVaultTimeoutPolicy = this.policyService.get$(PolicyType.MaximumVaultTimeout);
Expand Down
1 change: 1 addition & 0 deletions apps/browser/src/background/main.background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ export default class MainBackground {
this.logService,
this.keyService,
this.biometricStateService,
this.messagingService,
);

this.appIdService = new AppIdService(this.storageService, this.logService);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable } from "@angular/core";

import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";

Check warning on line 4 in apps/browser/src/key-management/biometrics/background-browser-biometrics.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/key-management/biometrics/background-browser-biometrics.service.ts#L4

Added line #L4 was not covered by tests
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
import { UserId } from "@bitwarden/common/types/guid";
Expand All @@ -23,6 +24,7 @@
private logService: LogService,
private keyService: KeyService,
private biometricStateService: BiometricStateService,
private messagingService: MessagingService,

Check warning on line 27 in apps/browser/src/key-management/biometrics/background-browser-biometrics.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/key-management/biometrics/background-browser-biometrics.service.ts#L27

Added line #L27 was not covered by tests
) {
super();
}
Expand Down Expand Up @@ -98,6 +100,8 @@
await this.biometricStateService.setBiometricUnlockEnabled(true);
await this.biometricStateService.setFingerprintValidated(true);
this.keyService.setUserKey(userKey, userId);
// to update badge and other things
this.messagingService.send("switchAccount", { userId });

Check warning on line 104 in apps/browser/src/key-management/biometrics/background-browser-biometrics.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/key-management/biometrics/background-browser-biometrics.service.ts#L104

Added line #L104 was not covered by tests
return userKey;
}
} else {
Expand All @@ -116,6 +120,8 @@
await this.biometricStateService.setBiometricUnlockEnabled(true);
await this.biometricStateService.setFingerprintValidated(true);
this.keyService.setUserKey(userKey, userId);
// to update badge and other things
this.messagingService.send("switchAccount", { userId });

Check warning on line 124 in apps/browser/src/key-management/biometrics/background-browser-biometrics.service.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/key-management/biometrics/background-browser-biometrics.service.ts#L124

Added line #L124 was not covered by tests
return userKey;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
MasterPasswordVerification,
MasterPasswordVerificationResponse,
} from "@bitwarden/common/auth/types/verification";
import { ClientType } from "@bitwarden/common/enums";
import { ClientType, DeviceType } from "@bitwarden/common/enums";

Check warning on line 33 in libs/key-management/src/angular/lock/components/lock.component.ts

View check run for this annotation

Codecov / codecov/patch

libs/key-management/src/angular/lock/components/lock.component.ts#L33

Added line #L33 was not covered by tests
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
Expand Down Expand Up @@ -301,6 +301,11 @@
}

if (this.clientType === "browser") {
// Firefox closes the popup when unfocused, so this would block all unlock methods
if (this.platformUtilsService.getDevice() === DeviceType.FirefoxExtension) {
return;

Check warning on line 306 in libs/key-management/src/angular/lock/components/lock.component.ts

View check run for this annotation

Codecov / codecov/patch

libs/key-management/src/angular/lock/components/lock.component.ts#L306

Added line #L306 was not covered by tests
}

if (
this.unlockOptions.biometrics.enabled &&
autoPromptBiometrics &&
Expand Down
Loading