Skip to content

Commit

Permalink
[8.8] [Security Solution] Fix color coding of severities is different…
Browse files Browse the repository at this point in the history
… at Entity analytics (#156383) (#156508)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Security Solution] Fix color coding of severities is different at
Entity analytics
(#156383)](#156383)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Pablo
Machado","email":"pablo.nevesmachado@elastic.co"},"sourceCommit":{"committedDate":"2023-05-03T10:46:19Z","message":"[Security
Solution] Fix color coding of severities is different at Entity
analytics (#156383)\n\nissue:
#143043
Summary\r\n\r\nFix color coding of severities is different at Entity
Analytics by using\r\nthe same colors of alert
severity.\r\n\r\n**Before:**\r\n\r\n![195068297-4893ff3e-184a-4deb-b551-28d55f4994fd](https://user-images.githubusercontent.com/1490444/235682183-272d0739-7a65-42d4-b1ef-83751cf57ab0.jpg)\r\n\r\n\r\n\r\n\r\n**After:**\r\n\r\n![Screenshot
2023-05-02 at 14
40\r\n23](https://user-images.githubusercontent.com/1490444/235678297-f4a05f1c-95f6-4895-a7b1-fd6645e55f7b.png)\r\n![Screenshot
2023-05-02 at 14
40\r\n03](https://user-images.githubusercontent.com/1490444/235678383-0eefe697-5669-496d-b0b8-44433f519754.png)\r\n![Screenshot
2023-05-02 at 14
37\r\n45](https://user-images.githubusercontent.com/1490444/235678609-257b8eb1-8b86-4064-8fbf-0c0b188174ae.png)\r\n\r\n![Screenshot
2023-05-02 at 15
32\r\n22](https://user-images.githubusercontent.com/1490444/235681736-609b484c-bd08-4379-b76b-6a47c3a016ba.png)","sha":"7f68428e3457b1720027ee88b3deb722b0151cbf","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Threat
Hunting","Team: SecuritySolution","Team:Threat
Hunting:Explore","v8.8.0","v8.9.0"],"number":156383,"url":"#156383
Solution] Fix color coding of severities is different at Entity
analytics (#156383)\n\nissue:
#143043
Summary\r\n\r\nFix color coding of severities is different at Entity
Analytics by using\r\nthe same colors of alert
severity.\r\n\r\n**Before:**\r\n\r\n![195068297-4893ff3e-184a-4deb-b551-28d55f4994fd](https://user-images.githubusercontent.com/1490444/235682183-272d0739-7a65-42d4-b1ef-83751cf57ab0.jpg)\r\n\r\n\r\n\r\n\r\n**After:**\r\n\r\n![Screenshot
2023-05-02 at 14
40\r\n23](https://user-images.githubusercontent.com/1490444/235678297-f4a05f1c-95f6-4895-a7b1-fd6645e55f7b.png)\r\n![Screenshot
2023-05-02 at 14
40\r\n03](https://user-images.githubusercontent.com/1490444/235678383-0eefe697-5669-496d-b0b8-44433f519754.png)\r\n![Screenshot
2023-05-02 at 14
37\r\n45](https://user-images.githubusercontent.com/1490444/235678609-257b8eb1-8b86-4064-8fbf-0c0b188174ae.png)\r\n\r\n![Screenshot
2023-05-02 at 15
32\r\n22](https://user-images.githubusercontent.com/1490444/235681736-609b484c-bd08-4379-b76b-6a47c3a016ba.png)","sha":"7f68428e3457b1720027ee88b3deb722b0151cbf"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156383","number":156383,"mergeCommit":{"message":"[Security
Solution] Fix color coding of severities is different at Entity
analytics (#156383)\n\nissue:
#143043
Summary\r\n\r\nFix color coding of severities is different at Entity
Analytics by using\r\nthe same colors of alert
severity.\r\n\r\n**Before:**\r\n\r\n![195068297-4893ff3e-184a-4deb-b551-28d55f4994fd](https://user-images.githubusercontent.com/1490444/235682183-272d0739-7a65-42d4-b1ef-83751cf57ab0.jpg)\r\n\r\n\r\n\r\n\r\n**After:**\r\n\r\n![Screenshot
2023-05-02 at 14
40\r\n23](https://user-images.githubusercontent.com/1490444/235678297-f4a05f1c-95f6-4895-a7b1-fd6645e55f7b.png)\r\n![Screenshot
2023-05-02 at 14
40\r\n03](https://user-images.githubusercontent.com/1490444/235678383-0eefe697-5669-496d-b0b8-44433f519754.png)\r\n![Screenshot
2023-05-02 at 14
37\r\n45](https://user-images.githubusercontent.com/1490444/235678609-257b8eb1-8b86-4064-8fbf-0c0b188174ae.png)\r\n\r\n![Screenshot
2023-05-02 at 15
32\r\n22](https://user-images.githubusercontent.com/1490444/235681736-609b484c-bd08-4379-b76b-6a47c3a016ba.png)","sha":"7f68428e3457b1720027ee88b3deb722b0151cbf"}}]}]
BACKPORT-->

Co-authored-by: Pablo Machado <pablo.nevesmachado@elastic.co>
  • Loading branch information
kibanamachine and machadoum committed May 3, 2023
1 parent ec982a7 commit 24c6e23
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Expand Up @@ -16,6 +16,7 @@ import { EuiHealth } from '@elastic/eui';
import { euiThemeVars } from '@kbn/ui-theme';
import { RiskSeverity } from '../../../../../../common/search_strategy';
import { RiskScore } from '.';
import { SEVERITY_COLOR } from '../../../../../overview/components/detection_response/utils';

jest.mock('@elastic/eui', () => {
const original = jest.requireActual('@elastic/eui');
Expand All @@ -37,7 +38,7 @@ describe('RiskScore', () => {
expect(container).toHaveTextContent(RiskSeverity.critical);

expect(EuiHealth as jest.Mock).toHaveBeenLastCalledWith(
expect.objectContaining({ color: euiThemeVars.euiColorDanger }),
expect.objectContaining({ color: SEVERITY_COLOR.critical }),
context
);
});
Expand All @@ -52,7 +53,7 @@ describe('RiskScore', () => {
expect(container).toHaveTextContent(RiskSeverity.high);

expect(EuiHealth as jest.Mock).toHaveBeenLastCalledWith(
expect.objectContaining({ color: euiThemeVars.euiColorVis9_behindText }),
expect.objectContaining({ color: SEVERITY_COLOR.high }),
context
);
});
Expand All @@ -67,7 +68,7 @@ describe('RiskScore', () => {
expect(container).toHaveTextContent(RiskSeverity.moderate);

expect(EuiHealth as jest.Mock).toHaveBeenLastCalledWith(
expect.objectContaining({ color: euiThemeVars.euiColorWarning }),
expect.objectContaining({ color: SEVERITY_COLOR.medium }),
context
);
});
Expand All @@ -82,7 +83,7 @@ describe('RiskScore', () => {
expect(container).toHaveTextContent(RiskSeverity.low);

expect(EuiHealth as jest.Mock).toHaveBeenLastCalledWith(
expect.objectContaining({ color: euiThemeVars.euiColorVis0 }),
expect.objectContaining({ color: SEVERITY_COLOR.low }),
context
);
});
Expand Down
Expand Up @@ -14,13 +14,14 @@ import { euiLightVars } from '@kbn/ui-theme';

import { WithHoverActions } from '../../../../../common/components/with_hover_actions';
import { RiskSeverity } from '../../../../../../common/search_strategy';
import { SEVERITY_COLOR } from '../../../../../overview/components/detection_response/utils';

export const RISK_SEVERITY_COLOUR: { [k in RiskSeverity]: string } = {
[RiskSeverity.unknown]: euiLightVars.euiColorMediumShade,
[RiskSeverity.low]: euiLightVars.euiColorVis0,
[RiskSeverity.moderate]: euiLightVars.euiColorWarning,
[RiskSeverity.high]: euiLightVars.euiColorVis9_behindText,
[RiskSeverity.critical]: euiLightVars.euiColorDanger,
[RiskSeverity.low]: SEVERITY_COLOR.low,
[RiskSeverity.moderate]: SEVERITY_COLOR.medium,
[RiskSeverity.high]: SEVERITY_COLOR.high,
[RiskSeverity.critical]: SEVERITY_COLOR.critical,
};

const RiskBadge = styled.div<{ $severity: RiskSeverity; $hideBackgroundColor: boolean }>`
Expand Down
Expand Up @@ -32,9 +32,10 @@ import { useQueryInspector } from '../../../../common/components/page/manage_que
import { ENTITY_ANALYTICS_ANOMALIES_PANEL } from '../anomalies';
import { isJobStarted } from '../../../../../common/machine_learning/helpers';
import { FormattedCount } from '../../../../common/components/formatted_number';
import { SEVERITY_COLOR } from '../../detection_response/utils';

const StyledEuiTitle = styled(EuiTitle)`
color: ${({ theme: { eui } }) => eui.euiColorDanger};
color: ${({ theme: { eui } }) => SEVERITY_COLOR.critical};
`;

const HOST_RISK_QUERY_ID = 'hostRiskScoreKpiQuery';
Expand Down

0 comments on commit 24c6e23

Please sign in to comment.