1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 06:43:35 +00:00

user decryption parsing error bug (#16346)

This commit is contained in:
Maciej Zieniuk
2025-09-08 22:56:22 +02:00
committed by GitHub
parent c017e3c676
commit 0d6a67fc81
2 changed files with 10 additions and 5 deletions

View File

@@ -35,9 +35,14 @@ describe("UserDecryptionResponse", () => {
);
});
it("should create response when masterPasswordUnlock is not provided", () => {
const userDecryptionResponse = new UserDecryptionResponse({});
it.each([null, undefined, "should be object type"])(
"should create response when masterPasswordUnlock is %s",
(masterPasswordUnlock) => {
const userDecryptionResponse = new UserDecryptionResponse({
MasterPasswordUnlock: masterPasswordUnlock,
});
expect(userDecryptionResponse.masterPasswordUnlock).toBeUndefined();
});
},
);
});

View File

@@ -8,7 +8,7 @@ export class UserDecryptionResponse extends BaseResponse {
super(response);
const masterPasswordUnlock = this.getResponseProperty("MasterPasswordUnlock");
if (masterPasswordUnlock != null || typeof masterPasswordUnlock === "object") {
if (masterPasswordUnlock != null && typeof masterPasswordUnlock === "object") {
this.masterPasswordUnlock = new MasterPasswordUnlockResponse(masterPasswordUnlock);
}
}