1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

[PM-20578] [PM-20579] Merge existing feature branch into main (#16364)

* PM-20578 Added api to fetch and save data (#15334)

* [PM-20579] Update risk-insights report service to use api service with encryption (#15357)

* Fix type error

* Fix paths for changed key generation service

* Finalize the api services

* Fixing test case for summary date range

* Fixing report service tests. Encryption will be modified in the future

* Fixing encryption service tests

* fixing linting issues

---------

Co-authored-by: Vijay Oommen <voommen@livefront.com>
Co-authored-by: Tom <ttalty@bitwarden.com>
This commit is contained in:
Leslie Tilton
2025-09-11 13:17:13 -05:00
committed by GitHub
parent a2e36c4489
commit 31d5b639e9
13 changed files with 806 additions and 63 deletions

View File

@@ -8,8 +8,10 @@ import {
RiskInsightsDataService,
RiskInsightsReportService,
} from "@bitwarden/bit-common/dirt/reports/risk-insights/services";
import { RiskInsightsEncryptionService } from "@bitwarden/bit-common/dirt/reports/risk-insights/services/risk-insights-encryption.service";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
import { KeyGenerationService } from "@bitwarden/common/key-management/crypto";
import { EncryptService } from "@bitwarden/common/key-management/crypto/abstractions/encrypt.service";
import { PasswordStrengthServiceAbstraction } from "@bitwarden/common/tools/password-strength/password-strength.service.abstraction";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
@@ -38,6 +40,11 @@ import { RiskInsightsComponent } from "./risk-insights.component";
provide: RiskInsightsDataService,
deps: [RiskInsightsReportService],
},
{
provide: RiskInsightsEncryptionService,
useClass: RiskInsightsEncryptionService,
deps: [KeyService, EncryptService, KeyGenerationService],
},
safeProvider({
provide: CriticalAppsService,
useClass: CriticalAppsService,

View File

@@ -16,6 +16,7 @@ import {
ApplicationHealthReportDetailWithCriticalFlagAndCipher,
ApplicationHealthReportSummary,
} from "@bitwarden/bit-common/dirt/reports/risk-insights/models/password-health";
import { RiskInsightsEncryptionService } from "@bitwarden/bit-common/dirt/reports/risk-insights/services/risk-insights-encryption.service";
import {
getOrganizationById,
OrganizationService,
@@ -108,7 +109,7 @@ export class AllApplicationsComponent implements OnInit {
if (data && organization) {
const dataWithCiphers = await this.reportService.identifyCiphers(
data,
organization.id,
organization.id as OrganizationId,
);
return {
@@ -145,6 +146,7 @@ export class AllApplicationsComponent implements OnInit {
protected reportService: RiskInsightsReportService,
private accountService: AccountService,
protected criticalAppsService: CriticalAppsService,
protected riskInsightsEncryptionService: RiskInsightsEncryptionService,
) {
this.searchControl.valueChanges
.pipe(debounceTime(200), takeUntilDestroyed())

View File

@@ -56,15 +56,18 @@ export class CriticalApplicationsComponent implements OnInit {
protected searchControl = new FormControl("", { nonNullable: true });
private destroyRef = inject(DestroyRef);
protected loading = false;
protected organizationId: string;
protected organizationId: OrganizationId;
protected applicationSummary = {} as ApplicationHealthReportSummary;
noItemsIcon = Security;
enableRequestPasswordChange = false;
async ngOnInit() {
this.organizationId = this.activatedRoute.snapshot.paramMap.get("organizationId") ?? "";
this.organizationId = this.activatedRoute.snapshot.paramMap.get(
"organizationId",
) as OrganizationId;
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
this.criticalAppsService.setOrganizationId(this.organizationId as OrganizationId, userId);
// this.criticalAppsService.setOrganizationId(this.organizationId as OrganizationId);
combineLatest([
this.dataService.applications$,
this.criticalAppsService.getAppsListForOrg(this.organizationId as OrganizationId),

View File

@@ -67,7 +67,7 @@ export class RiskInsightsComponent implements OnInit {
criticalAppsCount: number = 0;
notifiedMembersCount: number = 0;
private organizationId: string | null = null;
private organizationId: OrganizationId = "" as OrganizationId;
private destroyRef = inject(DestroyRef);
isLoading$: Observable<boolean> = new Observable<boolean>();
isRefreshing$: Observable<boolean> = new Observable<boolean>();
@@ -94,10 +94,10 @@ export class RiskInsightsComponent implements OnInit {
.pipe(
takeUntilDestroyed(this.destroyRef),
map((params) => params.get("organizationId")),
switchMap((orgId: string | null) => {
switchMap((orgId) => {
if (orgId) {
this.organizationId = orgId;
this.dataService.fetchApplicationsReport(orgId);
this.organizationId = orgId as OrganizationId;
this.dataService.fetchApplicationsReport(this.organizationId);
this.isLoading$ = this.dataService.isLoading$;
this.isRefreshing$ = this.dataService.isRefreshing$;
this.dataLastUpdated$ = this.dataService.dataLastUpdated$;