1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 18:53:29 +00:00

[PM-24353] Drop legacy pin support (#17328)

* Drop legacy pin support

* Fix cli build

* Fix browser build

* Remove pin key

* Fix comment

* Fix CI / tests

* Add migration to remove key

* Inline export key

* Extract vault export key generation

* Cleanup

* Add migrator

* Fix mv2 build
This commit is contained in:
Bernd Schoolmann
2025-12-11 13:01:09 +01:00
committed by GitHub
parent 404e07b6bd
commit 51d29f777e
26 changed files with 175 additions and 404 deletions

View File

@@ -7,8 +7,8 @@ import { safeProvider, SafeProvider } from "@bitwarden/angular/platform/utils/sa
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { KeyGenerationService } from "@bitwarden/common/key-management/crypto";
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
import { PinServiceAbstraction } from "@bitwarden/common/key-management/pin/pin.service.abstraction";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
@@ -84,7 +84,7 @@ export const ImporterProviders: SafeProvider[] = [
CollectionService,
KeyService,
EncryptService,
PinServiceAbstraction,
KeyGenerationService,
AccountService,
RestrictedItemTypesService,
],

View File

@@ -2,8 +2,8 @@ import { mock, MockProxy } from "jest-mock-extended";
import { of } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { KeyGenerationService } from "@bitwarden/common/key-management/crypto";
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
import { PinServiceAbstraction } from "@bitwarden/common/key-management/pin/pin.service.abstraction";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { emptyGuid, OrganizationId } from "@bitwarden/common/types/guid";
@@ -24,7 +24,7 @@ describe("BitwardenPasswordProtectedImporter", () => {
let encryptService: MockProxy<EncryptService>;
let i18nService: MockProxy<I18nService>;
let cipherService: MockProxy<CipherService>;
let pinService: MockProxy<PinServiceAbstraction>;
let keyGenerationService: MockProxy<KeyGenerationService>;
let accountService: MockProxy<AccountService>;
const password = Utils.newGuid();
const promptForPassword_callback = async () => {
@@ -36,7 +36,7 @@ describe("BitwardenPasswordProtectedImporter", () => {
encryptService = mock<EncryptService>();
i18nService = mock<I18nService>();
cipherService = mock<CipherService>();
pinService = mock<PinServiceAbstraction>();
keyGenerationService = mock<KeyGenerationService>();
accountService = mock<AccountService>();
accountService.activeAccount$ = of({
@@ -71,7 +71,7 @@ describe("BitwardenPasswordProtectedImporter", () => {
encryptService,
i18nService,
cipherService,
pinService,
keyGenerationService,
accountService,
promptForPassword_callback,
);
@@ -105,7 +105,7 @@ describe("BitwardenPasswordProtectedImporter", () => {
encryptService,
i18nService,
cipherService,
pinService,
keyGenerationService,
accountService,
promptForPassword_callback,
);

View File

@@ -1,9 +1,9 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { KeyGenerationService } from "@bitwarden/common/key-management/crypto";
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
import { EncString } from "@bitwarden/common/key-management/crypto/models/enc-string";
import { PinServiceAbstraction } from "@bitwarden/common/key-management/pin/pin.service.abstraction";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
@@ -29,7 +29,7 @@ export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter im
encryptService: EncryptService,
i18nService: I18nService,
cipherService: CipherService,
private pinService: PinServiceAbstraction,
private keyGenerationService: KeyGenerationService,
accountService: AccountService,
private promptForPassword_callback: () => Promise<string>,
) {
@@ -86,7 +86,7 @@ export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter im
? new PBKDF2KdfConfig(jdoc.kdfIterations)
: new Argon2KdfConfig(jdoc.kdfIterations, jdoc.kdfMemory, jdoc.kdfParallelism);
this.key = await this.pinService.makePinKey(password, jdoc.salt, kdfConfig);
this.key = await this.keyGenerationService.deriveVaultExportKey(password, jdoc.salt, kdfConfig);
const encKeyValidation = new EncString(jdoc.encKeyValidation_DO_NOT_EDIT);

View File

@@ -8,8 +8,8 @@ import {
CollectionView,
} from "@bitwarden/admin-console/common";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { KeyGenerationService } from "@bitwarden/common/key-management/crypto";
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
import { PinServiceAbstraction } from "@bitwarden/common/key-management/pin/pin.service.abstraction";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { CollectionId, OrganizationId } from "@bitwarden/common/types/guid";
@@ -36,7 +36,7 @@ describe("ImportService", () => {
let collectionService: MockProxy<CollectionService>;
let keyService: MockProxy<KeyService>;
let encryptService: MockProxy<EncryptService>;
let pinService: MockProxy<PinServiceAbstraction>;
let keyGenerationService: MockProxy<KeyGenerationService>;
let accountService: MockProxy<AccountService>;
let restrictedItemTypesService: MockProxy<RestrictedItemTypesService>;
@@ -48,7 +48,7 @@ describe("ImportService", () => {
collectionService = mock<CollectionService>();
keyService = mock<KeyService>();
encryptService = mock<EncryptService>();
pinService = mock<PinServiceAbstraction>();
keyGenerationService = mock<KeyGenerationService>();
restrictedItemTypesService = mock<RestrictedItemTypesService>();
importService = new ImportService(
@@ -59,7 +59,7 @@ describe("ImportService", () => {
collectionService,
keyService,
encryptService,
pinService,
keyGenerationService,
accountService,
restrictedItemTypesService,
);

View File

@@ -12,8 +12,8 @@ import {
} from "@bitwarden/admin-console/common";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { getUserId } from "@bitwarden/common/auth/services/account.service";
import { KeyGenerationService } from "@bitwarden/common/key-management/crypto";
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
import { PinServiceAbstraction } from "@bitwarden/common/key-management/pin/pin.service.abstraction";
import { ImportCiphersRequest } from "@bitwarden/common/models/request/import-ciphers.request";
import { ImportOrganizationCiphersRequest } from "@bitwarden/common/models/request/import-organization-ciphers.request";
import { KvpRequest } from "@bitwarden/common/models/request/kvp.request";
@@ -119,7 +119,7 @@ export class ImportService implements ImportServiceAbstraction {
private collectionService: CollectionService,
private keyService: KeyService,
private encryptService: EncryptService,
private pinService: PinServiceAbstraction,
private keyGenerationService: KeyGenerationService,
private accountService: AccountService,
private restrictedItemTypesService: RestrictedItemTypesService,
) {}
@@ -238,7 +238,7 @@ export class ImportService implements ImportServiceAbstraction {
this.encryptService,
this.i18nService,
this.cipherService,
this.pinService,
this.keyGenerationService,
this.accountService,
promptForPassword_callback,
);