mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-17 20:31:50 +01:00
[PM-7029] Remove key-rotation-feature-flag (#8816)
* Removed key rotation feature flag. * Fixed tests * Removed unused dependency. * Remove KeyRotationImprovements from default const
This commit is contained in:
parent
ff3b6f52ee
commit
a89e148804
@ -165,23 +165,4 @@ export class OrganizationUserResetPasswordService {
|
|||||||
}
|
}
|
||||||
return requests;
|
return requests;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Nov 6, 2023: Use new Key Rotation Service for posting rotated data.
|
|
||||||
*/
|
|
||||||
async postLegacyRotation(
|
|
||||||
userId: string,
|
|
||||||
requests: OrganizationUserResetPasswordWithIdRequest[],
|
|
||||||
): Promise<void> {
|
|
||||||
if (requests == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (const request of requests) {
|
|
||||||
await this.organizationUserService.putOrganizationUserResetPasswordEnrollment(
|
|
||||||
request.organizationId,
|
|
||||||
userId,
|
|
||||||
request,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -328,16 +328,4 @@ export class EmergencyAccessService {
|
|||||||
private async encryptKey(userKey: UserKey, publicKey: Uint8Array): Promise<EncryptedString> {
|
private async encryptKey(userKey: UserKey, publicKey: Uint8Array): Promise<EncryptedString> {
|
||||||
return (await this.cryptoService.rsaEncrypt(userKey.key, publicKey)).encryptedString;
|
return (await this.cryptoService.rsaEncrypt(userKey.key, publicKey)).encryptedString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Nov 6, 2023: Use new Key Rotation Service for posting rotated data.
|
|
||||||
*/
|
|
||||||
async postLegacyRotation(requests: EmergencyAccessWithIdRequest[]): Promise<void> {
|
|
||||||
if (requests == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (const request of requests) {
|
|
||||||
await this.emergencyAccessApiService.putEmergencyAccess(request.id, request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,6 @@ describe("KeyRotationService", () => {
|
|||||||
mockEncryptService,
|
mockEncryptService,
|
||||||
mockStateService,
|
mockStateService,
|
||||||
mockAccountService,
|
mockAccountService,
|
||||||
mockConfigService,
|
|
||||||
mockKdfConfigService,
|
mockKdfConfigService,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -191,16 +190,6 @@ describe("KeyRotationService", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses legacy rotation if feature flag is off", async () => {
|
|
||||||
mockConfigService.getFeatureFlag.mockResolvedValueOnce(false);
|
|
||||||
|
|
||||||
await keyRotationService.rotateUserKeyAndEncryptedData("mockMasterPassword");
|
|
||||||
|
|
||||||
expect(mockApiService.postUserKeyUpdate).toHaveBeenCalled();
|
|
||||||
expect(mockEmergencyAccessService.postLegacyRotation).toHaveBeenCalled();
|
|
||||||
expect(mockResetPasswordService.postLegacyRotation).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("throws if server rotation fails", async () => {
|
it("throws if server rotation fails", async () => {
|
||||||
mockApiService.postUserKeyUpdate.mockRejectedValueOnce(new Error("mockError"));
|
mockApiService.postUserKeyUpdate.mockRejectedValueOnce(new Error("mockError"));
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv
|
|||||||
import { DeviceTrustServiceAbstraction } from "@bitwarden/common/auth/abstractions/device-trust.service.abstraction";
|
import { DeviceTrustServiceAbstraction } from "@bitwarden/common/auth/abstractions/device-trust.service.abstraction";
|
||||||
import { KdfConfigService } from "@bitwarden/common/auth/abstractions/kdf-config.service";
|
import { KdfConfigService } from "@bitwarden/common/auth/abstractions/kdf-config.service";
|
||||||
import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
|
import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstractions/master-password.service.abstraction";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
|
||||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||||
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
|
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service";
|
||||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||||
@ -39,7 +37,6 @@ export class UserKeyRotationService {
|
|||||||
private encryptService: EncryptService,
|
private encryptService: EncryptService,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
private configService: ConfigService,
|
|
||||||
private kdfConfigService: KdfConfigService,
|
private kdfConfigService: KdfConfigService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@ -90,11 +87,7 @@ export class UserKeyRotationService {
|
|||||||
request.emergencyAccessKeys = await this.emergencyAccessService.getRotatedKeys(newUserKey);
|
request.emergencyAccessKeys = await this.emergencyAccessService.getRotatedKeys(newUserKey);
|
||||||
request.resetPasswordKeys = await this.resetPasswordService.getRotatedKeys(newUserKey);
|
request.resetPasswordKeys = await this.resetPasswordService.getRotatedKeys(newUserKey);
|
||||||
|
|
||||||
if (await this.configService.getFeatureFlag(FeatureFlag.KeyRotationImprovements)) {
|
|
||||||
await this.apiService.postUserKeyUpdate(request);
|
await this.apiService.postUserKeyUpdate(request);
|
||||||
} else {
|
|
||||||
await this.rotateUserKeyAndEncryptedDataLegacy(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
const activeAccount = await firstValueFrom(this.accountService.activeAccount$);
|
const activeAccount = await firstValueFrom(this.accountService.activeAccount$);
|
||||||
await this.deviceTrustService.rotateDevicesTrust(
|
await this.deviceTrustService.rotateDevicesTrust(
|
||||||
@ -139,16 +132,4 @@ export class UserKeyRotationService {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async rotateUserKeyAndEncryptedDataLegacy(request: UpdateKeyRequest): Promise<void> {
|
|
||||||
// Update keys, ciphers, folders, and sends
|
|
||||||
await this.apiService.postUserKeyUpdate(request);
|
|
||||||
|
|
||||||
// Update emergency access keys
|
|
||||||
await this.emergencyAccessService.postLegacyRotation(request.emergencyAccessKeys);
|
|
||||||
|
|
||||||
// Update account recovery keys
|
|
||||||
const userId = await this.stateService.getUserId();
|
|
||||||
await this.resetPasswordService.postLegacyRotation(userId, request.resetPasswordKeys);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ export enum FeatureFlag {
|
|||||||
FlexibleCollectionsV1 = "flexible-collections-v-1", // v-1 is intentional
|
FlexibleCollectionsV1 = "flexible-collections-v-1", // v-1 is intentional
|
||||||
VaultOnboarding = "vault-onboarding",
|
VaultOnboarding = "vault-onboarding",
|
||||||
GeneratorToolsModernization = "generator-tools-modernization",
|
GeneratorToolsModernization = "generator-tools-modernization",
|
||||||
KeyRotationImprovements = "key-rotation-improvements",
|
|
||||||
FlexibleCollectionsMigration = "flexible-collections-migration",
|
FlexibleCollectionsMigration = "flexible-collections-migration",
|
||||||
ShowPaymentMethodWarningBanners = "show-payment-method-warning-banners",
|
ShowPaymentMethodWarningBanners = "show-payment-method-warning-banners",
|
||||||
EnableConsolidatedBilling = "enable-consolidated-billing",
|
EnableConsolidatedBilling = "enable-consolidated-billing",
|
||||||
@ -37,7 +36,6 @@ export const DefaultFeatureFlagValue = {
|
|||||||
[FeatureFlag.FlexibleCollectionsV1]: FALSE,
|
[FeatureFlag.FlexibleCollectionsV1]: FALSE,
|
||||||
[FeatureFlag.VaultOnboarding]: FALSE,
|
[FeatureFlag.VaultOnboarding]: FALSE,
|
||||||
[FeatureFlag.GeneratorToolsModernization]: FALSE,
|
[FeatureFlag.GeneratorToolsModernization]: FALSE,
|
||||||
[FeatureFlag.KeyRotationImprovements]: FALSE,
|
|
||||||
[FeatureFlag.FlexibleCollectionsMigration]: FALSE,
|
[FeatureFlag.FlexibleCollectionsMigration]: FALSE,
|
||||||
[FeatureFlag.ShowPaymentMethodWarningBanners]: FALSE,
|
[FeatureFlag.ShowPaymentMethodWarningBanners]: FALSE,
|
||||||
[FeatureFlag.EnableConsolidatedBilling]: FALSE,
|
[FeatureFlag.EnableConsolidatedBilling]: FALSE,
|
||||||
|
Loading…
Reference in New Issue
Block a user