forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Entity Analytics] Show Asset Criticality in Risk Input Left Flyout (e…
…lastic#174638) ## Summary Show the asset criticality as part of the risk inputs under a new contexts section: <img width="1517" alt="Screenshot 2024-01-10 at 16 45 29" src="https://github.com/elastic/kibana/assets/3315046/4ab7fd16-2849-4d9c-8f1c-f9cd9b677e8f"> If there is no criticality assigned here is what it looks like: <img width="1098" alt="Screenshot 2024-01-10 at 12 05 28" src="https://github.com/elastic/kibana/assets/3315046/817e4397-1a3f-4e65-be27-dbadb364e693"> this is based off the criticality_level on the risk score document not the current asset criticality of the entity. ## Test steps Assign asset criticality to a host or user and raise alerts + a risk score for them, view the host details flyout and then expand risk inputs, the asset criticality at the time of the score should be shown.
- Loading branch information
1 parent
f4ddc9c
commit fa10460
Showing
30 changed files
with
446 additions
and
130 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/security_solution/common/entity_analytics/asset_criticality/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { AssetCriticalityRecord } from '../../api/entity_analytics/asset_criticality'; | ||
|
||
export type CriticalityLevel = AssetCriticalityRecord['criticality_level']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...solution/public/entity_analytics/components/asset_criticality/asset_criticality_badge.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import { EuiHealth, EuiText } from '@elastic/eui'; | ||
import { euiLightVars } from '@kbn/ui-theme'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { CRITICALITY_LEVEL_TITLE, CRITICALITY_LEVEL_DESCRIPTION } from './translations'; | ||
import type { CriticalityLevel } from '../../../../common/entity_analytics/asset_criticality/types'; | ||
|
||
const CRITICALITY_LEVEL_COLOR: Record<CriticalityLevel, string> = { | ||
very_important: '#E7664C', | ||
important: '#D6BF57', | ||
normal: '#54B399', | ||
not_important: euiLightVars.euiColorMediumShade, | ||
}; | ||
|
||
export const AssetCriticalityBadge: React.FC<{ | ||
criticalityLevel: CriticalityLevel; | ||
withDescription?: boolean; | ||
style?: React.CSSProperties; | ||
dataTestSubj?: string; | ||
}> = ({ | ||
criticalityLevel, | ||
style, | ||
dataTestSubj = 'asset-criticality-badge', | ||
withDescription = false, | ||
}) => { | ||
const showDescription = withDescription ?? false; | ||
const badgeContent = showDescription ? ( | ||
<> | ||
<strong>{CRITICALITY_LEVEL_TITLE[criticalityLevel]}</strong> | ||
<EuiText size="s" color="subdued"> | ||
<p>{CRITICALITY_LEVEL_DESCRIPTION[criticalityLevel]}</p> | ||
</EuiText> | ||
</> | ||
) : ( | ||
CRITICALITY_LEVEL_TITLE[criticalityLevel] | ||
); | ||
|
||
return ( | ||
<EuiHealth | ||
data-test-subj={dataTestSubj} | ||
color={CRITICALITY_LEVEL_COLOR[criticalityLevel]} | ||
style={style} | ||
> | ||
{badgeContent} | ||
</EuiHealth> | ||
); | ||
}; | ||
|
||
export const AssetCriticalityBadgeAllowMissing: React.FC<{ | ||
criticalityLevel?: CriticalityLevel; | ||
withDescription?: boolean; | ||
style?: React.CSSProperties; | ||
dataTestSubj?: string; | ||
}> = ({ criticalityLevel, style, dataTestSubj, withDescription }) => { | ||
if (criticalityLevel) { | ||
return ( | ||
<AssetCriticalityBadge | ||
criticalityLevel={criticalityLevel} | ||
dataTestSubj={dataTestSubj} | ||
withDescription={withDescription} | ||
style={style} | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<EuiHealth color="subdued" data-test-subj={dataTestSubj}> | ||
<FormattedMessage | ||
id="xpack.securitySolution.entityAnalytics.assetCriticality.noCriticality" | ||
defaultMessage="No criticality assigned" | ||
/> | ||
</EuiHealth> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
.../plugins/security_solution/public/entity_analytics/components/asset_criticality/common.ts
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...k/plugins/security_solution/public/entity_analytics/components/asset_criticality/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export * from './asset_criticality_badge'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.