1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-22 12:24:01 +00:00

[PM-17038] Fix biometrics autoprompt in firefox and chrome (#12853)

* Fix biometrics not working in firefox or windows

* Remove logs

* Update badge after biometric unlock

* Add removal todo note

* Remove debug logging

* Fix type warnings

* Fix userkey typing in background biometrics service

* Simplify types for userkey in foreground-browser-biometrics and runtime.background.ts

* Add process reload logging

* Fix autoprompt not working when no process reload happened

* Fix instant reprompt on firefox lock

* Fix biometrics enabling error on chrome

* Update apps/browser/src/key-management/biometrics/foreground-browser-biometrics.ts

Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>

* FIx build & linting

---------

Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com>
(cherry picked from commit 318a3ac6a9)
This commit is contained in:
Bernd Schoolmann
2025-01-14 18:29:52 +01:00
parent 94395abd3b
commit 8f8131121e
4 changed files with 22 additions and 6 deletions

View File

@@ -39,6 +39,9 @@ export class DefaultProcessReloadService implements ProcessReloadServiceAbstract
let status = await firstValueFrom(authService.authStatusFor$(userId as UserId));
status = await authService.getAuthStatus(userId);
if (status === AuthenticationStatus.Unlocked) {
this.logService.info(
"[Process Reload Service] User unlocked, preventing process reload",
);
return;
}
}
@@ -55,6 +58,9 @@ export class DefaultProcessReloadService implements ProcessReloadServiceAbstract
if (userId != null) {
const ephemeralPin = await this.pinService.getPinKeyEncryptedUserKeyEphemeral(userId);
if (ephemeralPin != null) {
this.logService.info(
"[Process Reload Service] Ephemeral pin active, preventing process reload",
);
return;
}
}
@@ -97,7 +103,12 @@ export class DefaultProcessReloadService implements ProcessReloadServiceAbstract
await this.reloadCallback();
}
return;
} else {
this.logService.info(
"[Process Reload Service] Desktop ipc fingerprint validated, preventing process reload",
);
}
if (this.reloadInterval == null) {
this.reloadInterval = setInterval(async () => await this.executeProcessReload(), 1000);
}

View File

@@ -307,10 +307,12 @@ export class LockComponent implements OnInit, OnDestroy {
(await this.biometricService.getShouldAutopromptNow())
) {
await this.biometricService.setShouldAutopromptNow(false);
const lastProcessReload = await this.biometricStateService.getLastProcessReload();
if (
(await this.biometricStateService.getLastProcessReload()) == null ||
Date.now() - (await this.biometricStateService.getLastProcessReload()).getTime() >
AUTOPROMPT_BIOMETRICS_PROCESS_RELOAD_DELAY
lastProcessReload == null ||
isNaN(lastProcessReload.getTime()) ||
Date.now() - lastProcessReload.getTime() > AUTOPROMPT_BIOMETRICS_PROCESS_RELOAD_DELAY
) {
await this.unlockViaBiometrics();
}