From bc019ce14d1f33cccd64e6d985845cb4da03b98c Mon Sep 17 00:00:00 2001 From: voommen-livefront Date: Mon, 12 May 2025 11:19:16 -0500 Subject: [PATCH] PM-20577 remove unwanted encryption --- .../services/risk-insights-report.service.ts | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/risk-insights-report.service.ts b/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/risk-insights-report.service.ts index 8dd9ad775d1..07e45c1b0de 100644 --- a/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/risk-insights-report.service.ts +++ b/bitwarden_license/bit-common/src/dirt/reports/risk-insights/services/risk-insights-report.service.ts @@ -200,11 +200,6 @@ export class RiskInsightsReportService { key: wrappedReportContentEncryptionKey.encryptedString, }; - const encryptedReportDataWithWrappedKey = await this.encryptService.encryptString( - JSON.stringify(reportDataWithWrappedKey), - orgKey, - ); - const criticalApps = await firstValueFrom( this.criticalAppsService .getAppsListForOrg(organizationId) @@ -214,7 +209,7 @@ export class RiskInsightsReportService { const riskInsightReport = { organizationId: organizationId, date: new Date().toISOString(), - reportData: encryptedReportDataWithWrappedKey.encryptedString, + reportData: JSON.stringify(reportDataWithWrappedKey), totalMembers: summary.totalMemberCount, totalAtRiskMembers: summary.totalAtRiskMemberCount, totalApplications: summary.totalApplicationCount, @@ -235,21 +230,12 @@ export class RiskInsightsReportService { throw new Error("Organization key not found"); } - const decryptedReportDataWithWrappedKey = await this.encryptService.decryptString( - new EncString(riskInsightsReportResponse.reportData), - orgKey, - ); - - const reportDataInJson = JSON.parse(decryptedReportDataWithWrappedKey); + const reportDataInJson = JSON.parse(riskInsightsReportResponse.reportData); const reportEncrypted = reportDataInJson.data; const wrappedReportContentEncryptionKey = reportDataInJson.key; - const freshWrappedReportContentEncryptionKey = new EncString( - wrappedReportContentEncryptionKey, - ); - const unwrappedReportContentEncryptionKey = await this.encryptService.unwrapSymmetricKey( - freshWrappedReportContentEncryptionKey, + new EncString(wrappedReportContentEncryptionKey), orgKey, ); @@ -269,7 +255,6 @@ export class RiskInsightsReportService { return [reportJson, summary]; } catch { - // console.error("Error decrypting risk insights report :", error); return [null, null]; } }