mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-16 10:45:20 +01:00
[EC-598] feat: do not exclude organization credentials
This commit is contained in:
parent
489c438ff4
commit
6d969439ef
@ -143,6 +143,19 @@ describe("FidoAuthenticatorService", () => {
|
||||
await expect(result).rejects.toThrowError(Fido2AutenticatorErrorCode.NotAllowed);
|
||||
});
|
||||
|
||||
/** Devation: Organization ciphers are not checked against excluded credentials, even if the user has access to them. */
|
||||
it("should not inform user of duplication when the excluded credential belongs to an organization", async () => {
|
||||
userInterfaceSession.informExcludedCredential.mockResolvedValue();
|
||||
excludedCipher.organizationId = "someOrganizationId";
|
||||
|
||||
try {
|
||||
await authenticator.makeCredential(params);
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch {}
|
||||
|
||||
expect(userInterfaceSession.informExcludedCredential).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should not inform user of duplication when input data does not pass checks", async () => {
|
||||
userInterfaceSession.informExcludedCredential.mockResolvedValue();
|
||||
const invalidParams = await createInvalidParams();
|
||||
@ -204,6 +217,19 @@ describe("FidoAuthenticatorService", () => {
|
||||
await expect(result).rejects.toThrowError(Fido2AutenticatorErrorCode.NotAllowed);
|
||||
});
|
||||
|
||||
/** Devation: Organization ciphers are not checked against excluded credentials, even if the user has access to them. */
|
||||
it.only("should not inform user of duplication when the excluded credential belongs to an organization", async () => {
|
||||
userInterfaceSession.informExcludedCredential.mockResolvedValue();
|
||||
excludedCipherView.organizationId = "someOrganizationId";
|
||||
|
||||
try {
|
||||
await authenticator.makeCredential(params);
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch {}
|
||||
|
||||
expect(userInterfaceSession.informExcludedCredential).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should not inform user of duplication when input data does not pass checks", async () => {
|
||||
userInterfaceSession.informExcludedCredential.mockResolvedValue();
|
||||
const invalidParams = await createInvalidParams();
|
||||
|
@ -273,10 +273,11 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
||||
return ciphers
|
||||
.filter(
|
||||
(cipher) =>
|
||||
(cipher.type === CipherType.Fido2Key && ids.includes(cipher.id)) ||
|
||||
cipher.organizationId == undefined &&
|
||||
((cipher.type === CipherType.Fido2Key && ids.includes(cipher.id)) ||
|
||||
(cipher.type === CipherType.Login &&
|
||||
cipher.login.fido2Key != undefined &&
|
||||
ids.includes(cipher.login.fido2Key.nonDiscoverableId))
|
||||
ids.includes(cipher.login.fido2Key.nonDiscoverableId)))
|
||||
)
|
||||
.map((cipher) => cipher.id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user