Skip to content

Commit

Permalink
[8.x] [Cloud Security] Populate Missing Vulnerability Scores in Vulne…
Browse files Browse the repository at this point in the history
…rabilities Flyout (#193659)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Cloud Security] Populate Missing Vulnerability Scores in
Vulnerabilities Flyout](#193656)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ido
Cohen","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-22T14:31:13Z","message":"[Cloud
Security] Populate Missing Vulnerability Scores in Vulnerabilities
Flyout","sha":"2a428b4e06efa9291b1ac67d86be6a86cd1284b3","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Cloud
Security","backport:prev-minor"],"title":"[Cloud Security] Populate
Missing Vulnerability Scores in Vulnerabilities Flyout
","number":193656,"url":"https://github.com/elastic/kibana/pull/193656","mergeCommit":{"message":"[Cloud
Security] Populate Missing Vulnerability Scores in Vulnerabilities
Flyout","sha":"2a428b4e06efa9291b1ac67d86be6a86cd1284b3"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193656","number":193656,"mergeCommit":{"message":"[Cloud
Security] Populate Missing Vulnerability Scores in Vulnerabilities
Flyout","sha":"2a428b4e06efa9291b1ac67d86be6a86cd1284b3"}}]}]
BACKPORT-->

---------

Co-authored-by: Ido Cohen <[email protected]>
  • Loading branch information
kibanamachine and CohenIdo authored Sep 22, 2024
1 parent ea4ee39 commit b9761fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -93,8 +94,10 @@ describe('<VulnerabilityFindingFlyout/>', () => {
);
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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -309,8 +310,8 @@ export const VulnerabilityOverviewTab = ({ vulnerabilityRecord }: VulnerabilityT

<EuiHorizontalRule css={horizontalStyle} />

{cvssScores?.length > 0 && (
<EuiFlexItem>
{
<EuiFlexItem data-test-subj={VULNERABILITY_SCORES_FLYOUT}>
<h4 css={flyoutSubheadingStyle}>
<FormattedMessage
id="xpack.csp.vulnerabilities.vulnerabilityOverviewTab.vulnerabilityScores"
Expand All @@ -324,10 +325,10 @@ export const VulnerabilityOverviewTab = ({ vulnerabilityRecord }: VulnerabilityT
margin-top: ${euiThemeVars.euiSizeS};
`}
>
{cvssScores}
{!!cvssScores?.length ? cvssScores : EMPTY_VALUE}
</EuiFlexGroup>
</EuiFlexItem>
)}
}
</EuiFlexGroup>
);
};

0 comments on commit b9761fb

Please sign in to comment.