Remove Fido2VaultCredentials feature flag (#7463)

* Removed Fido2 client credentials feature flag

* Removed test for feature flag.
This commit is contained in:
Todd Martin 2024-01-09 12:56:58 -05:00 committed by GitHub
parent b144f5bce7
commit c9a2f07e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 37 deletions

View File

@ -1,6 +1,4 @@
export enum FeatureFlag { export enum FeatureFlag {
DisplayLowKdfIterationWarningFlag = "display-kdf-iteration-warning",
Fido2VaultCredentials = "fido2-vault-credentials",
TrustedDeviceEncryption = "trusted-device-encryption", TrustedDeviceEncryption = "trusted-device-encryption",
PasswordlessLogin = "passwordless-login", PasswordlessLogin = "passwordless-login",
AutofillV2 = "autofill-v2", AutofillV2 = "autofill-v2",

View File

@ -42,7 +42,6 @@ describe("FidoAuthenticatorService", () => {
stateService = mock<StateService>(); stateService = mock<StateService>();
client = new Fido2ClientService(authenticator, configService, authService, stateService); client = new Fido2ClientService(authenticator, configService, authService, stateService);
configService.getFeatureFlag.mockResolvedValue(true);
configService.serverConfig$ = of({ environment: { vault: VaultUrl } } as any); configService.serverConfig$ = of({ environment: { vault: VaultUrl } } as any);
stateService.getEnablePasskeys.mockResolvedValue(true); stateService.getEnablePasskeys.mockResolvedValue(true);
authService.getAuthStatus.mockResolvedValue(AuthenticationStatus.Unlocked); authService.getAuthStatus.mockResolvedValue(AuthenticationStatus.Unlocked);
@ -225,16 +224,6 @@ describe("FidoAuthenticatorService", () => {
await rejects.toBeInstanceOf(DOMException); await rejects.toBeInstanceOf(DOMException);
}); });
it("should throw FallbackRequestedError if feature flag is not enabled", async () => {
const params = createParams();
configService.getFeatureFlag.mockResolvedValue(false);
const result = async () => await client.createCredential(params, tab);
const rejects = expect(result).rejects;
await rejects.toThrow(FallbackRequestedError);
});
it("should throw FallbackRequestedError if passkeys state is not enabled", async () => { it("should throw FallbackRequestedError if passkeys state is not enabled", async () => {
const params = createParams(); const params = createParams();
stateService.getEnablePasskeys.mockResolvedValue(false); stateService.getEnablePasskeys.mockResolvedValue(false);
@ -405,16 +394,6 @@ describe("FidoAuthenticatorService", () => {
await rejects.toBeInstanceOf(DOMException); await rejects.toBeInstanceOf(DOMException);
}); });
it("should throw FallbackRequestedError if feature flag is not enabled", async () => {
const params = createParams();
configService.getFeatureFlag.mockResolvedValue(false);
const result = async () => await client.assertCredential(params, tab);
const rejects = expect(result).rejects;
await rejects.toThrow(FallbackRequestedError);
});
it("should throw FallbackRequestedError if passkeys state is not enabled", async () => { it("should throw FallbackRequestedError if passkeys state is not enabled", async () => {
const params = createParams(); const params = createParams();
stateService.getEnablePasskeys.mockResolvedValue(false); stateService.getEnablePasskeys.mockResolvedValue(false);

View File

@ -3,7 +3,6 @@ import { parse } from "tldts";
import { AuthService } from "../../../auth/abstractions/auth.service"; import { AuthService } from "../../../auth/abstractions/auth.service";
import { AuthenticationStatus } from "../../../auth/enums/authentication-status"; import { AuthenticationStatus } from "../../../auth/enums/authentication-status";
import { FeatureFlag } from "../../../enums/feature-flag.enum";
import { ConfigServiceAbstraction } from "../../../platform/abstractions/config/config.service.abstraction"; import { ConfigServiceAbstraction } from "../../../platform/abstractions/config/config.service.abstraction";
import { LogService } from "../../../platform/abstractions/log.service"; import { LogService } from "../../../platform/abstractions/log.service";
import { StateService } from "../../../platform/abstractions/state.service"; import { StateService } from "../../../platform/abstractions/state.service";
@ -57,20 +56,9 @@ export class Fido2ClientService implements Fido2ClientServiceAbstraction {
const serverConfig = await firstValueFrom(this.configService.serverConfig$); const serverConfig = await firstValueFrom(this.configService.serverConfig$);
const isOriginEqualBitwardenVault = origin === serverConfig.environment?.vault; const isOriginEqualBitwardenVault = origin === serverConfig.environment?.vault;
if ( return (
!userEnabledPasskeys || userEnabledPasskeys && isUserLoggedIn && !isExcludedDomain && !isOriginEqualBitwardenVault
!isUserLoggedIn ||
isExcludedDomain ||
isOriginEqualBitwardenVault
) {
return false;
}
const featureFlagEnabled = await this.configService.getFeatureFlag<boolean>(
FeatureFlag.Fido2VaultCredentials,
); );
return featureFlagEnabled;
} }
async createCredential( async createCredential(