mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[8.18] [Security Solution][Entity Analytics][Bug]Adding code to get spaceId dynamically (#216063) (#216254)
# Backport This will backport the following commits from `main` to `8.18`: - [[Security Solution][Entity Analytics][Bug]Adding code to get spaceId dynamically (#216063)](https://github.com/elastic/kibana/pull/216063) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Abhishek Bhatia","email":"117628830+abhishekbhatia1710@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-28T06:59:27Z","message":"[Security Solution][Entity Analytics][Bug]Adding code to get spaceId dynamically (#216063)\n\n## Summary\n\nThe Risk Summary in the Entity Flyout was displaying an incorrect risk\nscore due to the space name not being accounted for in the risk score\nindex query.\n\nThis update ensures that the namespace is properly considered while\nquerying the risk score, providing accurate results across different\nspaces.\n\nScreen recording : \n\n\n\nhttps://github.com/user-attachments/assets/91df526c-1c22-4d53-aa0c-d74abb54920a\n\n\nTesting Steps : \n1. Navigate to Entity Risk Score page.\n2. Add data in the `default` space\n3. Check for Risk score in the Risk Summary for any of the entities in\nthe Entity Flyout.\n4. The Risk score in the Entities table and the flyout should be same\n5. Create a new space\n6. Add data in the new space\n7. Check for Risk score in the Risk Summary for any of the entities in\nthe Entity Flyout.\n8. The Risk score in the Entities table and the flyout should be same\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ffb196f8e6f04db25b2b9ce12213d3cb8267173f","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","Team:Entity Analytics","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[Security Solution][Entity Analytics][Bug]Adding code to get spaceId dynamically","number":216063,"url":"https://github.com/elastic/kibana/pull/216063","mergeCommit":{"message":"[Security Solution][Entity Analytics][Bug]Adding code to get spaceId dynamically (#216063)\n\n## Summary\n\nThe Risk Summary in the Entity Flyout was displaying an incorrect risk\nscore due to the space name not being accounted for in the risk score\nindex query.\n\nThis update ensures that the namespace is properly considered while\nquerying the risk score, providing accurate results across different\nspaces.\n\nScreen recording : \n\n\n\nhttps://github.com/user-attachments/assets/91df526c-1c22-4d53-aa0c-d74abb54920a\n\n\nTesting Steps : \n1. Navigate to Entity Risk Score page.\n2. Add data in the `default` space\n3. Check for Risk score in the Risk Summary for any of the entities in\nthe Entity Flyout.\n4. The Risk score in the Entities table and the flyout should be same\n5. Create a new space\n6. Add data in the new space\n7. Check for Risk score in the Risk Summary for any of the entities in\nthe Entity Flyout.\n8. The Risk score in the Entities table and the flyout should be same\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ffb196f8e6f04db25b2b9ce12213d3cb8267173f"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216063","number":216063,"mergeCommit":{"message":"[Security Solution][Entity Analytics][Bug]Adding code to get spaceId dynamically (#216063)\n\n## Summary\n\nThe Risk Summary in the Entity Flyout was displaying an incorrect risk\nscore due to the space name not being accounted for in the risk score\nindex query.\n\nThis update ensures that the namespace is properly considered while\nquerying the risk score, providing accurate results across different\nspaces.\n\nScreen recording : \n\n\n\nhttps://github.com/user-attachments/assets/91df526c-1c22-4d53-aa0c-d74abb54920a\n\n\nTesting Steps : \n1. Navigate to Entity Risk Score page.\n2. Add data in the `default` space\n3. Check for Risk score in the Risk Summary for any of the entities in\nthe Entity Flyout.\n4. The Risk score in the Entities table and the flyout should be same\n5. Create a new space\n6. Add data in the new space\n7. Check for Risk score in the Risk Summary for any of the entities in\nthe Entity Flyout.\n8. The Risk score in the Entities table and the flyout should be same\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ffb196f8e6f04db25b2b9ce12213d3cb8267173f"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Abhishek Bhatia <117628830+abhishekbhatia1710@users.noreply.github.com>
This commit is contained in:
parent
3af1098ba3
commit
0bc14342fb
1 changed files with 4 additions and 2 deletions
|
@ -34,6 +34,7 @@ import { VisualizationEmbeddable } from '../../../common/components/visualizatio
|
|||
import { ExpandablePanel } from '../../../flyout/shared/components/expandable_panel';
|
||||
import type { RiskScoreState } from '../../api/hooks/use_risk_score';
|
||||
import { getRiskScoreSummaryAttributes } from '../../lens_attributes/risk_score_summary';
|
||||
import { useSpaceId } from '../../../common/hooks/use_space_id';
|
||||
|
||||
import {
|
||||
buildColumns,
|
||||
|
@ -70,6 +71,7 @@ const FlyoutRiskSummaryComponent = <T extends EntityType>({
|
|||
const riskData = data && data.length > 0 ? data[0] : undefined;
|
||||
const entityData = getEntityData<T>(entityType, riskData);
|
||||
const { euiTheme } = useEuiTheme();
|
||||
const spaceId = useSpaceId();
|
||||
const lensAttributes = useMemo(() => {
|
||||
const entityName = entityData?.name ?? '';
|
||||
const fieldName = EntityTypeToIdentifierField[entityType];
|
||||
|
@ -77,12 +79,12 @@ const FlyoutRiskSummaryComponent = <T extends EntityType>({
|
|||
return getRiskScoreSummaryAttributes({
|
||||
severity: entityData?.risk?.calculated_level,
|
||||
query: `${fieldName}: ${entityName}`,
|
||||
spaceId: 'default',
|
||||
spaceId,
|
||||
riskEntity: entityType,
|
||||
// TODO: add in riskColors when severity palette agreed on.
|
||||
// https://github.com/elastic/security-team/issues/11516 hook - https://github.com/elastic/kibana/pull/206276
|
||||
});
|
||||
}, [entityData?.name, entityData?.risk?.calculated_level, entityType]);
|
||||
}, [entityData?.name, entityData?.risk?.calculated_level, entityType, spaceId]);
|
||||
const xsFontSize = useEuiFontSize('xxs').fontSize;
|
||||
|
||||
const columns = useMemo(() => buildColumns(), []);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue