From f274540896d7f453c8f58da095e4d2c9498a9899 Mon Sep 17 00:00:00 2001 From: SmithThe4th Date: Thu, 26 Jan 2023 14:55:24 -0500 Subject: [PATCH] [SG-997] Add warning for low kdf iterations (#4570) * Created low kdf component * added low kdf transalation message * Registered commponent * Referenced low kdf child compoenent to vault * Added showLowKdf variable to determine if card should be shown * Removed test flag * Updated renamed enum * Capitalized kdf text --- .../web/src/app/settings/low-kdf.component.html | 17 +++++++++++++++++ apps/web/src/app/settings/low-kdf.component.ts | 7 +++++++ .../src/app/shared/loose-components.module.ts | 3 +++ apps/web/src/app/vault/vault.component.html | 1 + apps/web/src/app/vault/vault.component.ts | 10 ++++++++++ apps/web/src/locales/en/messages.json | 9 +++++++++ 6 files changed, 47 insertions(+) create mode 100644 apps/web/src/app/settings/low-kdf.component.html create mode 100644 apps/web/src/app/settings/low-kdf.component.ts diff --git a/apps/web/src/app/settings/low-kdf.component.html b/apps/web/src/app/settings/low-kdf.component.html new file mode 100644 index 0000000000..239c63bb9d --- /dev/null +++ b/apps/web/src/app/settings/low-kdf.component.html @@ -0,0 +1,17 @@ +
+
+ + {{ "lowKdfIterations" | i18n }} +
+
+

{{ "lowKdfIterationsDesc" | i18n }}

+ + {{ "changeKdfSettings" | i18n }} + +
+
diff --git a/apps/web/src/app/settings/low-kdf.component.ts b/apps/web/src/app/settings/low-kdf.component.ts new file mode 100644 index 0000000000..a411c1402f --- /dev/null +++ b/apps/web/src/app/settings/low-kdf.component.ts @@ -0,0 +1,7 @@ +import { Component } from "@angular/core"; + +@Component({ + selector: "app-low-kdf", + templateUrl: "low-kdf.component.html", +}) +export class LowKdfComponent {} diff --git a/apps/web/src/app/shared/loose-components.module.ts b/apps/web/src/app/shared/loose-components.module.ts index f9dcda0594..1cb5832bc9 100644 --- a/apps/web/src/app/shared/loose-components.module.ts +++ b/apps/web/src/app/shared/loose-components.module.ts @@ -74,6 +74,7 @@ import { EmergencyAccessTakeoverComponent } from "../settings/emergency-access-t import { EmergencyAccessViewComponent } from "../settings/emergency-access-view.component"; import { EmergencyAccessComponent } from "../settings/emergency-access.component"; import { EmergencyAddEditComponent } from "../settings/emergency-add-edit.component"; +import { LowKdfComponent } from "../settings/low-kdf.component"; import { OrganizationPlansComponent } from "../settings/organization-plans.component"; import { PaymentMethodComponent } from "../settings/payment-method.component"; import { PaymentComponent } from "../settings/payment.component"; @@ -227,6 +228,7 @@ import { SharedModule } from "./shared.module"; VerifyEmailComponent, VerifyEmailTokenComponent, VerifyRecoverDeleteComponent, + LowKdfComponent, ], exports: [ PremiumBadgeComponent, @@ -335,6 +337,7 @@ import { SharedModule } from "./shared.module"; VerifyEmailComponent, VerifyEmailTokenComponent, VerifyRecoverDeleteComponent, + LowKdfComponent, ], }) export class LooseComponentsModule {} diff --git a/apps/web/src/app/vault/vault.component.html b/apps/web/src/app/vault/vault.component.html index 0cc95a4533..44feb609b9 100644 --- a/apps/web/src/app/vault/vault.component.html +++ b/apps/web/src/app/vault/vault.component.html @@ -83,6 +83,7 @@ + (); @@ -96,6 +99,7 @@ export class VaultComponent implements OnInit, OnDestroy { async ngOnInit() { this.showVerifyEmail = !(await this.tokenService.getEmailVerified()); this.showBrowserOutdated = window.navigator.userAgent.indexOf("MSIE") !== -1; + this.showLowKdf = await this.isLowKdfIteration(); this.trashCleanupWarning = this.i18nService.t( this.platformUtilsService.isSelfHost() ? "trashCleanupWarningSelfHosted" @@ -388,6 +392,12 @@ export class VaultComponent implements OnInit, OnDestroy { await this.modalService.openViewRef(UpdateKeyComponent, this.updateKeyModalRef); } + async isLowKdfIteration() { + const kdfIterations = await this.stateService.getKdfIterations(); + + return kdfIterations < DEFAULT_PBKDF2_ITERATIONS; + } + get breadcrumbs(): TreeNode[] { if (!this.activeFilter.selectedCollectionNode) { return []; diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 10bf8aea55..0772ef4521 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -6082,5 +6082,14 @@ "example": "2" } } + }, + "lowKdfIterations": { + "message": "Low KDF Iterations" + }, + "lowKdfIterationsDesc": { + "message": "Increase your KDF encryption settings to improve the security of your account." + }, + "changeKdfSettings": { + "message": "Change KDF settings" } }