Skip to content

Commit

Permalink
Remove biometrics autoprompt on firefox (#12856)
Browse files Browse the repository at this point in the history
  • Loading branch information
quexten authored Jan 15, 2025
1 parent a8dbc4d commit 6deb347
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
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 { PolicyService } from "@bitwarden/common/admin-console/abstractions/poli
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 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {
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 @@ export class AccountSecurityComponent implements OnInit, OnDestroy {
) {}

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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
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 @@ export class LockComponent implements OnInit, OnDestroy {
}

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

0 comments on commit 6deb347

Please sign in to comment.