mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
shallow copy credentials in strategies that store them (#7047)
- add warnings about dead objects in firefox
This commit is contained in:
@@ -58,7 +58,9 @@ export class AuthRequestLoginStrategy extends LoginStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override async logIn(credentials: AuthRequestLoginCredentials) {
|
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(
|
this.tokenRequest = new PasswordTokenRequest(
|
||||||
credentials.email,
|
credentials.email,
|
||||||
|
|||||||
@@ -61,7 +61,9 @@ export class WebAuthnLoginStrategy extends LoginStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async logIn(credentials: WebAuthnLoginCredentials) {
|
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(
|
this.tokenRequest = new WebAuthnLoginTokenRequest(
|
||||||
credentials.token,
|
credentials.token,
|
||||||
|
|||||||
@@ -208,6 +208,8 @@ export class AuthService implements AuthServiceAbstraction {
|
|||||||
break;
|
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);
|
const result = await strategy.logIn(credentials as any);
|
||||||
|
|
||||||
if (result?.requiresTwoFactor) {
|
if (result?.requiresTwoFactor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user