From f76276d303b41cf43cfc44cdb9f6f87f22f4084a Mon Sep 17 00:00:00 2001 From: Leslie Tilton <23057410+Banrion@users.noreply.github.com> Date: Mon, 7 Jul 2025 11:12:24 -0500 Subject: [PATCH] Remove debugging tabs (#15510) --- ...password-health-members-uri.component.html | 51 ------- ...sword-health-members-uri.component.spec.ts | 77 ----------- .../password-health-members-uri.component.ts | 107 --------------- .../password-health-members.component.html | 60 --------- .../password-health-members.component.ts | 127 ------------------ .../password-health.component.html | 53 -------- .../password-health.component.spec.ts | 49 ------- .../password-health.component.ts | 69 ---------- .../risk-insights.component.html | 9 -- .../risk-insights.component.ts | 10 -- 10 files changed, 612 deletions(-) delete mode 100644 bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.html delete mode 100644 bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.spec.ts delete mode 100644 bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.ts delete mode 100644 bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members.component.html delete mode 100644 bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members.component.ts delete mode 100644 bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.html delete mode 100644 bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.spec.ts delete mode 100644 bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.ts diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.html b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.html deleted file mode 100644 index 936d92d8701..00000000000 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.html +++ /dev/null @@ -1,51 +0,0 @@ - -

{{ "passwordsReportDesc" | i18n }}

-
- - {{ "loading" | i18n }} -
-
- - - {{ "application" | i18n }} - {{ "weakness" | i18n }} - {{ "timesReused" | i18n }} - {{ "timesExposed" | i18n }} - {{ "totalMembers" | i18n }} - - - - - {{ row.hostURI }} - - - - - {{ passwordStrengthMap.get(row.id)[0] | i18n }} - - - - - {{ "reusedXTimes" | i18n: passwordUseMap.get(row.login.password) }} - - - - - {{ "exposedXTimes" | i18n: exposedPasswordMap.get(row.id) }} - - - - {{ totalMembersMap.get(row.id) || 0 }} - - - -
-
diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.spec.ts b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.spec.ts deleted file mode 100644 index e827f884ead..00000000000 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.spec.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { ComponentFixture, TestBed } from "@angular/core/testing"; -import { ActivatedRoute, convertToParamMap } from "@angular/router"; -import { mock, MockProxy } from "jest-mock-extended"; -import { of } from "rxjs"; - -import { - MemberCipherDetailsApiService, - PasswordHealthService, -} from "@bitwarden/bit-common/dirt/reports/risk-insights"; -import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { AuditService } from "@bitwarden/common/abstractions/audit.service"; -import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; -import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { Utils } from "@bitwarden/common/platform/misc/utils"; -import { mockAccountServiceWith } from "@bitwarden/common/spec"; -import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; -import { UserId } from "@bitwarden/common/types/guid"; -import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { TableModule } from "@bitwarden/components"; -import { LooseComponentsModule } from "@bitwarden/web-vault/app/shared"; -import { PipesModule } from "@bitwarden/web-vault/app/vault/individual-vault/pipes/pipes.module"; - -import { PasswordHealthMembersURIComponent } from "./password-health-members-uri.component"; - -describe("PasswordHealthMembersUriComponent", () => { - let component: PasswordHealthMembersURIComponent; - let fixture: ComponentFixture; - let cipherServiceMock: MockProxy; - const passwordHealthServiceMock = mock(); - const userId = Utils.newGuid() as UserId; - - const activeRouteParams = convertToParamMap({ organizationId: "orgId" }); - - beforeEach(async () => { - cipherServiceMock = mock(); - await TestBed.configureTestingModule({ - imports: [PasswordHealthMembersURIComponent, PipesModule, TableModule, LooseComponentsModule], - providers: [ - { provide: CipherService, useValue: cipherServiceMock }, - { provide: I18nService, useValue: mock() }, - { provide: AuditService, useValue: mock() }, - { provide: OrganizationService, useValue: mock() }, - { provide: AccountService, useValue: mockAccountServiceWith(userId) }, - { - provide: PasswordStrengthServiceAbstraction, - useValue: mock(), - }, - { provide: PasswordHealthService, useValue: passwordHealthServiceMock }, - { - provide: ActivatedRoute, - useValue: { - paramMap: of(activeRouteParams), - url: of([]), - }, - }, - { - provide: MemberCipherDetailsApiService, - useValue: mock(), - }, - { - provide: ApiService, - useValue: mock(), - }, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(PasswordHealthMembersURIComponent); - component = fixture.componentInstance; - }); - - it("should initialize component", () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.ts b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.ts deleted file mode 100644 index a4e8dd0ded8..00000000000 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members-uri.component.ts +++ /dev/null @@ -1,107 +0,0 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore -import { CommonModule } from "@angular/common"; -import { Component, DestroyRef, inject, OnInit } from "@angular/core"; -import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; -import { ActivatedRoute } from "@angular/router"; -import { map } from "rxjs"; - -import { JslibModule } from "@bitwarden/angular/jslib.module"; -import { - MemberCipherDetailsApiService, - PasswordHealthService, -} from "@bitwarden/bit-common/dirt/reports/risk-insights"; -import { AuditService } from "@bitwarden/common/abstractions/audit.service"; -import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; -import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; -import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; -import { - BadgeModule, - BadgeVariant, - ContainerComponent, - TableDataSource, - TableModule, -} from "@bitwarden/components"; -import { HeaderModule } from "@bitwarden/web-vault/app/layouts/header/header.module"; -import { PipesModule } from "@bitwarden/web-vault/app/vault/individual-vault/pipes/pipes.module"; - -@Component({ - selector: "tools-password-health-members-uri", - templateUrl: "password-health-members-uri.component.html", - imports: [ - BadgeModule, - CommonModule, - ContainerComponent, - PipesModule, - JslibModule, - HeaderModule, - TableModule, - ], - providers: [PasswordHealthService, MemberCipherDetailsApiService], -}) -export class PasswordHealthMembersURIComponent implements OnInit { - passwordStrengthMap = new Map(); - - weakPasswordCiphers: CipherView[] = []; - - passwordUseMap = new Map(); - - exposedPasswordMap = new Map(); - - totalMembersMap = new Map(); - - dataSource = new TableDataSource(); - - reportCiphers: (CipherView & { hostURI: string })[] = []; - reportCipherURIs: string[] = []; - - organization: Organization; - - loading = true; - - private destroyRef = inject(DestroyRef); - - constructor( - protected cipherService: CipherService, - protected passwordStrengthService: PasswordStrengthServiceAbstraction, - protected organizationService: OrganizationService, - protected auditService: AuditService, - protected i18nService: I18nService, - protected activatedRoute: ActivatedRoute, - protected memberCipherDetailsApiService: MemberCipherDetailsApiService, - ) {} - - ngOnInit() { - this.activatedRoute.paramMap - .pipe( - takeUntilDestroyed(this.destroyRef), - map(async (params) => { - const organizationId = params.get("organizationId"); - await this.setCiphers(organizationId); - }), - ) - .subscribe(); - } - - async setCiphers(organizationId: string) { - const passwordHealthService = new PasswordHealthService( - this.passwordStrengthService, - this.auditService, - this.cipherService, - this.memberCipherDetailsApiService, - organizationId, - ); - - await passwordHealthService.generateReport(); - - this.dataSource.data = passwordHealthService.groupCiphersByLoginUri(); - this.exposedPasswordMap = passwordHealthService.exposedPasswordMap; - this.passwordStrengthMap = passwordHealthService.passwordStrengthMap; - this.passwordUseMap = passwordHealthService.passwordUseMap; - this.totalMembersMap = passwordHealthService.totalMembersMap; - this.loading = false; - } -} diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members.component.html b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members.component.html deleted file mode 100644 index 5c980f75a81..00000000000 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members.component.html +++ /dev/null @@ -1,60 +0,0 @@ -

{{ "passwordsReportDesc" | i18n }}

-
- - {{ "loading" | i18n }} -
-
- - - - {{ "name" | i18n }} - {{ "weakness" | i18n }} - {{ "timesReused" | i18n }} - {{ "timesExposed" | i18n }} - {{ "totalMembers" | i18n }} - - - - - - - - {{ row.name }} - -
- {{ row.subTitle }} - - - - {{ passwordStrengthMap.get(row.id)[0] | i18n }} - - - - - {{ "reusedXTimes" | i18n: passwordUseMap.get(row.login.password) }} - - - - - {{ "exposedXTimes" | i18n: exposedPasswordMap.get(row.id) }} - - - - {{ totalMembersMap.get(row.id) || 0 }} - -
-
-
diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members.component.ts b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members.component.ts deleted file mode 100644 index 8cad1f2f8ce..00000000000 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health-members.component.ts +++ /dev/null @@ -1,127 +0,0 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore -import { Component, DestroyRef, inject, OnInit } from "@angular/core"; -import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; -import { FormControl, FormsModule } from "@angular/forms"; -import { ActivatedRoute } from "@angular/router"; -import { debounceTime, map } from "rxjs"; - -import { - MemberCipherDetailsApiService, - PasswordHealthService, -} from "@bitwarden/bit-common/dirt/reports/risk-insights"; -import { AuditService } from "@bitwarden/common/abstractions/audit.service"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength"; -import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; -import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; -import { - BadgeVariant, - SearchModule, - TableDataSource, - TableModule, - ToastService, -} from "@bitwarden/components"; -import { HeaderModule } from "@bitwarden/web-vault/app/layouts/header/header.module"; -import { SharedModule } from "@bitwarden/web-vault/app/shared"; -import { PipesModule } from "@bitwarden/web-vault/app/vault/individual-vault/pipes/pipes.module"; - -@Component({ - selector: "tools-password-health-members", - templateUrl: "password-health-members.component.html", - imports: [PipesModule, HeaderModule, SearchModule, FormsModule, SharedModule, TableModule], - providers: [PasswordHealthService, MemberCipherDetailsApiService], -}) -export class PasswordHealthMembersComponent implements OnInit { - passwordStrengthMap = new Map(); - - passwordUseMap = new Map(); - - exposedPasswordMap = new Map(); - - totalMembersMap = new Map(); - - dataSource = new TableDataSource(); - - loading = true; - - selectedIds: Set = new Set(); - - protected searchControl = new FormControl("", { nonNullable: true }); - - private destroyRef = inject(DestroyRef); - - constructor( - protected cipherService: CipherService, - protected passwordStrengthService: PasswordStrengthServiceAbstraction, - protected auditService: AuditService, - protected i18nService: I18nService, - protected activatedRoute: ActivatedRoute, - protected toastService: ToastService, - protected memberCipherDetailsApiService: MemberCipherDetailsApiService, - ) { - this.searchControl.valueChanges - .pipe(debounceTime(200), takeUntilDestroyed()) - .subscribe((v) => (this.dataSource.filter = v)); - } - - ngOnInit() { - this.activatedRoute.paramMap - .pipe( - takeUntilDestroyed(this.destroyRef), - map(async (params) => { - const organizationId = params.get("organizationId"); - await this.setCiphers(organizationId); - }), - ) - .subscribe(); - } - - async setCiphers(organizationId: string) { - const passwordHealthService = new PasswordHealthService( - this.passwordStrengthService, - this.auditService, - this.cipherService, - this.memberCipherDetailsApiService, - organizationId, - ); - - await passwordHealthService.generateReport(); - - this.dataSource.data = passwordHealthService.reportCiphers; - - this.exposedPasswordMap = passwordHealthService.exposedPasswordMap; - this.passwordStrengthMap = passwordHealthService.passwordStrengthMap; - this.passwordUseMap = passwordHealthService.passwordUseMap; - this.totalMembersMap = passwordHealthService.totalMembersMap; - this.loading = false; - } - - markAppsAsCritical = async () => { - // TODO: Send to API once implemented - return new Promise((resolve) => { - setTimeout(() => { - this.selectedIds.clear(); - this.toastService.showToast({ - variant: "success", - title: null, - message: this.i18nService.t("appsMarkedAsCritical"), - }); - resolve(true); - }, 1000); - }); - }; - - trackByFunction(_: number, item: CipherView) { - return item.id; - } - - onCheckboxChange(id: number, event: Event) { - const isChecked = (event.target as HTMLInputElement).checked; - if (isChecked) { - this.selectedIds.add(id); - } else { - this.selectedIds.delete(id); - } - } -} diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.html b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.html deleted file mode 100644 index b798a75ab3a..00000000000 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.html +++ /dev/null @@ -1,53 +0,0 @@ - -

{{ "passwordsReportDesc" | i18n }}

-
- - {{ "loading" | i18n }} -
-
- - - - {{ "name" | i18n }} - {{ "weakness" | i18n }} - {{ "timesReused" | i18n }} - {{ "timesExposed" | i18n }} - - - - - - - - {{ row.name }} - -
- {{ row.subTitle }} - - - - {{ row.weakPasswordDetail?.detailValue.label | i18n }} - - - - - {{ "reusedXTimes" | i18n: passwordUseMap.get(row.login.password) }} - - - - - {{ "exposedXTimes" | i18n: row.exposedPasswordDetail?.exposedXTimes }} - - -
-
-
-
diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.spec.ts b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.spec.ts deleted file mode 100644 index f7c821f123a..00000000000 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.spec.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ComponentFixture, TestBed } from "@angular/core/testing"; -import { ActivatedRoute, convertToParamMap } from "@angular/router"; -import { mock } from "jest-mock-extended"; -import { of } from "rxjs"; - -import { RiskInsightsReportService } from "@bitwarden/bit-common/dirt/reports/risk-insights"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { TableModule } from "@bitwarden/components"; -import { LooseComponentsModule } from "@bitwarden/web-vault/app/shared"; -import { PipesModule } from "@bitwarden/web-vault/app/vault/individual-vault/pipes/pipes.module"; - -import { PasswordHealthComponent } from "./password-health.component"; - -describe("PasswordHealthComponent", () => { - let component: PasswordHealthComponent; - let fixture: ComponentFixture; - const activeRouteParams = convertToParamMap({ organizationId: "orgId" }); - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [PasswordHealthComponent, PipesModule, TableModule, LooseComponentsModule], - declarations: [], - providers: [ - { provide: RiskInsightsReportService, useValue: mock() }, - { provide: I18nService, useValue: mock() }, - { - provide: ActivatedRoute, - useValue: { - paramMap: of(activeRouteParams), - url: of([]), - }, - }, - ], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(PasswordHealthComponent); - component = fixture.componentInstance; - - fixture.detectChanges(); - }); - - it("should initialize component", () => { - expect(component).toBeTruthy(); - }); - - it("should call generateReport on init", () => {}); -}); diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.ts b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.ts deleted file mode 100644 index 16c783c3f4f..00000000000 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/password-health.component.ts +++ /dev/null @@ -1,69 +0,0 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore -import { CommonModule } from "@angular/common"; -import { Component, DestroyRef, inject, OnInit } from "@angular/core"; -import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; -import { ActivatedRoute } from "@angular/router"; -import { firstValueFrom, map } from "rxjs"; - -import { JslibModule } from "@bitwarden/angular/jslib.module"; -import { RiskInsightsReportService } from "@bitwarden/bit-common/dirt/reports/risk-insights"; -import { CipherHealthReportDetail } from "@bitwarden/bit-common/dirt/reports/risk-insights/models/password-health"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { - BadgeModule, - ContainerComponent, - TableDataSource, - TableModule, -} from "@bitwarden/components"; -import { HeaderModule } from "@bitwarden/web-vault/app/layouts/header/header.module"; -import { OrganizationBadgeModule } from "@bitwarden/web-vault/app/vault/individual-vault/organization-badge/organization-badge.module"; -import { PipesModule } from "@bitwarden/web-vault/app/vault/individual-vault/pipes/pipes.module"; - -@Component({ - selector: "tools-password-health", - templateUrl: "password-health.component.html", - imports: [ - BadgeModule, - OrganizationBadgeModule, - CommonModule, - ContainerComponent, - PipesModule, - JslibModule, - HeaderModule, - TableModule, - ], -}) -export class PasswordHealthComponent implements OnInit { - passwordUseMap = new Map(); - dataSource = new TableDataSource(); - - loading = true; - - private destroyRef = inject(DestroyRef); - - constructor( - protected riskInsightsReportService: RiskInsightsReportService, - protected i18nService: I18nService, - protected activatedRoute: ActivatedRoute, - ) {} - - ngOnInit() { - this.activatedRoute.paramMap - .pipe( - takeUntilDestroyed(this.destroyRef), - map(async (params) => { - const organizationId = params.get("organizationId"); - await this.setCiphers(organizationId); - }), - ) - .subscribe(); - } - - async setCiphers(organizationId: string) { - this.dataSource.data = await firstValueFrom( - this.riskInsightsReportService.generateRawDataReport$(organizationId), - ); - this.loading = false; - } -} diff --git a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/risk-insights.component.html b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/risk-insights.component.html index c9408b806ff..627db269097 100644 --- a/bitwarden_license/bit-web/src/app/dirt/access-intelligence/risk-insights.component.html +++ b/bitwarden_license/bit-web/src/app/dirt/access-intelligence/risk-insights.component.html @@ -45,15 +45,6 @@ - - - - - - - - - = new Observable(); - showDebugTabs: boolean = false; appsCount: number = 0; criticalAppsCount: number = 0; @@ -97,8 +89,6 @@ export class RiskInsightsComponent implements OnInit { } async ngOnInit() { - this.showDebugTabs = devFlagEnabled("showRiskInsightsDebug"); - this.route.paramMap .pipe( takeUntilDestroyed(this.destroyRef),