mirror of
https://github.com/bitwarden/browser
synced 2025-01-01 20:57:53 +01:00
shallow copy credentials in strategies that store them (#7047)
- add warnings about dead objects in firefox
This commit is contained in:
parent
0b9a2775f0
commit
cf6ed0d8a6
@ -58,7 +58,9 @@ export class AuthRequestLoginStrategy extends LoginStrategy {
|
||||
}
|
||||
|
||||
override async logIn(credentials: AuthRequestLoginCredentials) {
|
||||
this.authRequestCredentials = credentials;
|
||||
// NOTE: To avoid DeadObject references on Firefox, do not set the credentials object directly
|
||||
// Use deep copy in future if objects are added that were created in popup
|
||||
this.authRequestCredentials = { ...credentials };
|
||||
|
||||
this.tokenRequest = new PasswordTokenRequest(
|
||||
credentials.email,
|
||||
|
@ -61,7 +61,9 @@ export class WebAuthnLoginStrategy extends LoginStrategy {
|
||||
}
|
||||
|
||||
async logIn(credentials: WebAuthnLoginCredentials) {
|
||||
this.credentials = credentials;
|
||||
// NOTE: To avoid DeadObject references on Firefox, do not set the credentials object directly
|
||||
// Use deep copy in future if objects are added that were created in popup
|
||||
this.credentials = { ...credentials };
|
||||
|
||||
this.tokenRequest = new WebAuthnLoginTokenRequest(
|
||||
credentials.token,
|
||||
|
@ -208,6 +208,8 @@ export class AuthService implements AuthServiceAbstraction {
|
||||
break;
|
||||
}
|
||||
|
||||
// Note: Do not set the credentials object directly on the strategy. They are
|
||||
// created in the popup and can cause DeadObject references on Firefox.
|
||||
const result = await strategy.logIn(credentials as any);
|
||||
|
||||
if (result?.requiresTwoFactor) {
|
||||
|
Loading…
Reference in New Issue
Block a user