From b9761fb32fa9ae1d57511cf6e839dc3f392b8feb Mon Sep 17 00:00:00 2001
From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Date: Mon, 23 Sep 2024 02:40:43 +1000
Subject: [PATCH] [8.x] [Cloud Security] Populate Missing Vulnerability Scores
in Vulnerabilities Flyout (#193659)
# Backport
This will backport the following commits from `main` to `8.x`:
- [[Cloud Security] Populate Missing Vulnerability Scores in
Vulnerabilities Flyout](https://github.com/elastic/kibana/pull/193656)
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)
---------
Co-authored-by: Ido Cohen <90558359+CohenIdo@users.noreply.github.com>
---
.../public/pages/vulnerabilities/test_subjects.ts | 1 +
.../vulnerability_finding_flyout.test.tsx | 3 +++
.../vulnerability_overview_tab.tsx | 9 +++++----
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/test_subjects.ts b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/test_subjects.ts
index b1eddf50f7c14..6393bd8799683 100644
--- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/test_subjects.ts
+++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/test_subjects.ts
@@ -11,6 +11,7 @@ export const JSON_TAB_VULNERABILITY_FLYOUT = 'vulnerability_json_tab_flyout';
export const OVERVIEW_TAB_VULNERABILITY_FLYOUT = 'vulnerability_overview_tab_flyout';
export const DATA_SOURCE_VULNERABILITY_FLYOUT = 'vulnerability_flyout_data_source_display_box';
export const PUBLISHED_DATE_VULNERABILITY_FLYOUT = 'vulnerability_flyout_date_display_box';
+export const VULNERABILITY_SCORES_FLYOUT = 'vulnerability_flyout_score';
export const TAB_ID_VULNERABILITY_FLYOUT = (tabId: string) =>
`vulnerability-finding-flyout-tab-${tabId}`;
diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_finding_flyout.test.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_finding_flyout.test.tsx
index 081eff33c5c96..8f3f37390cfae 100644
--- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_finding_flyout.test.tsx
+++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_finding_flyout.test.tsx
@@ -17,6 +17,7 @@ import {
DATA_SOURCE_VULNERABILITY_FLYOUT,
FINDINGS_VULNERABILITY_FLYOUT_DESCRIPTION_LIST,
PUBLISHED_DATE_VULNERABILITY_FLYOUT,
+ VULNERABILITY_SCORES_FLYOUT,
} from '../test_subjects';
import { EMPTY_VALUE } from '../../configurations/findings_flyout/findings_flyout';
@@ -93,8 +94,10 @@ describe('', () => {
);
const dataSource = getByTestId(DATA_SOURCE_VULNERABILITY_FLYOUT);
const publisedDate = getByTestId(PUBLISHED_DATE_VULNERABILITY_FLYOUT);
+ const vulnerabilityScores = getByTestId(VULNERABILITY_SCORES_FLYOUT);
expect(dataSource.textContent).toEqual(`Data Source${EMPTY_VALUE}`);
expect(publisedDate.textContent).toEqual(`Published Date${EMPTY_VALUE}`);
+ expect(vulnerabilityScores.textContent).toEqual(`Vulnerability Scores${EMPTY_VALUE}`);
});
it('show empty state for no fixes', () => {
diff --git a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx
index 9848bbd402e50..e25bbbf6c3111 100644
--- a/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx
+++ b/x-pack/plugins/cloud_security_posture/public/pages/vulnerabilities/vulnerabilities_finding_flyout/vulnerability_overview_tab.tsx
@@ -33,6 +33,7 @@ import {
DATA_SOURCE_VULNERABILITY_FLYOUT,
OVERVIEW_TAB_VULNERABILITY_FLYOUT,
PUBLISHED_DATE_VULNERABILITY_FLYOUT,
+ VULNERABILITY_SCORES_FLYOUT,
} from '../test_subjects';
import redhatLogo from '../../../assets/icons/redhat_logo.svg';
import { VulnerabilityDetectionRuleCounter } from './vulnerability_detection_rule_counter';
@@ -309,8 +310,8 @@ export const VulnerabilityOverviewTab = ({ vulnerabilityRecord }: VulnerabilityT
- {cvssScores?.length > 0 && (
-
+ {
+
- {cvssScores}
+ {!!cvssScores?.length ? cvssScores : EMPTY_VALUE}
- )}
+ }
);
};