mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
[EC-598] feat: do not exclude organization credentials
This commit is contained in:
@@ -143,6 +143,19 @@ describe("FidoAuthenticatorService", () => {
|
|||||||
await expect(result).rejects.toThrowError(Fido2AutenticatorErrorCode.NotAllowed);
|
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 () => {
|
it("should not inform user of duplication when input data does not pass checks", async () => {
|
||||||
userInterfaceSession.informExcludedCredential.mockResolvedValue();
|
userInterfaceSession.informExcludedCredential.mockResolvedValue();
|
||||||
const invalidParams = await createInvalidParams();
|
const invalidParams = await createInvalidParams();
|
||||||
@@ -204,6 +217,19 @@ describe("FidoAuthenticatorService", () => {
|
|||||||
await expect(result).rejects.toThrowError(Fido2AutenticatorErrorCode.NotAllowed);
|
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 () => {
|
it("should not inform user of duplication when input data does not pass checks", async () => {
|
||||||
userInterfaceSession.informExcludedCredential.mockResolvedValue();
|
userInterfaceSession.informExcludedCredential.mockResolvedValue();
|
||||||
const invalidParams = await createInvalidParams();
|
const invalidParams = await createInvalidParams();
|
||||||
|
|||||||
@@ -273,10 +273,11 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
return ciphers
|
return ciphers
|
||||||
.filter(
|
.filter(
|
||||||
(cipher) =>
|
(cipher) =>
|
||||||
(cipher.type === CipherType.Fido2Key && ids.includes(cipher.id)) ||
|
cipher.organizationId == undefined &&
|
||||||
(cipher.type === CipherType.Login &&
|
((cipher.type === CipherType.Fido2Key && ids.includes(cipher.id)) ||
|
||||||
cipher.login.fido2Key != undefined &&
|
(cipher.type === CipherType.Login &&
|
||||||
ids.includes(cipher.login.fido2Key.nonDiscoverableId))
|
cipher.login.fido2Key != undefined &&
|
||||||
|
ids.includes(cipher.login.fido2Key.nonDiscoverableId)))
|
||||||
)
|
)
|
||||||
.map((cipher) => cipher.id);
|
.map((cipher) => cipher.id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user