Skip to content

Commit

Permalink
[Entity Store] Enablement UI (#196076)
Browse files Browse the repository at this point in the history
### Entity store enablement UI


This PR adds a UI to enable the Entity Store.




### How to test

1. Enable `entityStoreEnabled` experimental feature flag
2. Navigate to `Security > Dashboards > Entity Analytics`
3. Work through the distinct flows to enable the store
    * For example, choose to enable risk score together with the store
4. Navigate to `Security > Manage > Entity Store` to start/stop the
store
5. Validate that the appropriate transforms and pipelines have been
initialized and have the correct status (for example, via the Stack
Management UI)
    
 

EDIT:
Enablement flow screenshots:

#### Enable both risk score and entity store
![Screenshot 2024-10-15 at 12 14
40](https://github.com/user-attachments/assets/90ab2eaa-dd73-47b4-b940-c9549422e37c)

#### Enable Risk score only (Entity store already enabled)
![Screenshot 2024-10-15 at 12 15
04](https://github.com/user-attachments/assets/3ef31857-7515-4636-adde-f6c6e7f7c13b)

#### Modal to choose what to enable
![Screenshot 2024-10-15 at 12 14
48](https://github.com/user-attachments/assets/1746767a-cfb0-41c0-823c-cafac45bd901)


#### New Entity Store management page
![Screenshot 2024-10-15 at 12 14
08](https://github.com/user-attachments/assets/aa2b8c63-1fcf-4a18-87d2-cecceaabd6cd)

---------

Co-authored-by: jaredburgettelastic <[email protected]>
Co-authored-by: machadoum <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Mark Hopkin <[email protected]>
Co-authored-by: natasha-moore-elastic <[email protected]>
  • Loading branch information
6 people authored Oct 15, 2024
1 parent f0f1775 commit 58b2c6e
Show file tree
Hide file tree
Showing 45 changed files with 1,552 additions and 433 deletions.
1 change: 1 addition & 0 deletions oas_docs/output/kibana.serverless.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48009,6 +48009,7 @@ components:
- started
- stopped
- updating
- error
type: string
Security_Entity_Analytics_API_Entity:
oneOf:
Expand Down
1 change: 1 addition & 0 deletions oas_docs/output/kibana.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48009,6 +48009,7 @@ components:
- started
- stopped
- updating
- error
type: string
Security_Entity_Analytics_API_Entity:
oneOf:
Expand Down
1 change: 1 addition & 0 deletions oas_docs/output/kibana.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56775,6 +56775,7 @@ components:
- started
- stopped
- updating
- error
type: string
Security_Entity_Analytics_API_Entity:
oneOf:
Expand Down
1 change: 1 addition & 0 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56775,6 +56775,7 @@ components:
- started
- stopped
- updating
- error
type: string
Security_Entity_Analytics_API_Entity:
oneOf:
Expand Down
1 change: 1 addition & 0 deletions packages/deeplinks/security/deep_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export enum SecurityPageName {
entityAnalytics = 'entity_analytics',
entityAnalyticsManagement = 'entity_analytics-management',
entityAnalyticsAssetClassification = 'entity_analytics-asset-classification',
entityAnalyticsEntityStoreManagement = 'entity_analytics-entity_store_management',
coverageOverview = 'coverage-overview',
notes = 'notes',
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type IndexPattern = z.infer<typeof IndexPattern>;
export const IndexPattern = z.string();

export type EngineStatus = z.infer<typeof EngineStatus>;
export const EngineStatus = z.enum(['installing', 'started', 'stopped', 'updating']);
export const EngineStatus = z.enum(['installing', 'started', 'stopped', 'updating', 'error']);
export type EngineStatusEnum = typeof EngineStatus.enum;
export const EngineStatusEnum = EngineStatus.enum;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ components:
- started
- stopped
- updating
- error

IndexPattern:
type: string
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export const ENTITY_ANALYTICS_PATH = '/entity_analytics' as const;
export const ENTITY_ANALYTICS_MANAGEMENT_PATH = `/entity_analytics_management` as const;
export const ENTITY_ANALYTICS_ASSET_CRITICALITY_PATH =
`/entity_analytics_asset_criticality` as const;
export const ENTITY_ANALYTICS_ENTITY_STORE_MANAGEMENT_PATH =
`/entity_analytics_entity_store` as const;
export const APP_ALERTS_PATH = `${APP_PATH}${ALERTS_PATH}` as const;
export const APP_CASES_PATH = `${APP_PATH}${CASES_PATH}` as const;
export const APP_ENDPOINTS_PATH = `${APP_PATH}${ENDPOINTS_PATH}` as const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ components:
- started
- stopped
- updating
- error
type: string
Entity:
oneOf:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ components:
- started
- stopped
- updating
- error
type: string
Entity:
oneOf:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const CATEGORIES: Array<SeparatorLinkCategory<SolutionPageName>> = [
type: LinkCategoryType.separator,
linkIds: [
SecurityPageName.entityAnalyticsManagement,
SecurityPageName.entityAnalyticsAssetClassification,
SecurityPageName.entityAnalyticsEntityStoreManagement,
], // Linked from the management cards landing.
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as i18n from './settings_translations';

const ENTITY_ANALYTICS_LINKS = [
SecurityPageName.entityAnalyticsManagement,
SecurityPageName.entityAnalyticsAssetClassification,
SecurityPageName.entityAnalyticsEntityStoreManagement,
];

export const createSettingsLinksFromManage = (manageLink: LinkItem): LinkItem[] => {
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/security_solution/public/app/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export const ENTITY_ANALYTICS_RISK_SCORE = i18n.translate(
}
);

export const ENTITY_STORE = i18n.translate('xpack.securitySolution.navigation.entityStore', {
defaultMessage: 'Entity Store',
});

export const NOTES = i18n.translate('xpack.securitySolution.navigation.notes', {
defaultMessage: 'Notes',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ describe('Security links', () => {
describe('isLinkUiSettingsAllowed', () => {
const SETTING_KEY = 'test setting';
const mockedLink: LinkItem = {
id: SecurityPageName.entityAnalyticsAssetClassification,
id: SecurityPageName.entityAnalyticsEntityStoreManagement,
title: 'test title',
path: '/test_path',
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* 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 { useMemo } from 'react';
import type {
DeleteEntityEngineResponse,
EntityType,
GetEntityEngineResponse,
InitEntityEngineResponse,
ListEntityEnginesResponse,
StopEntityEngineResponse,
} from '../../../common/api/entity_analytics';
import { API_VERSIONS } from '../../../common/entity_analytics/constants';
import { useKibana } from '../../common/lib/kibana/kibana_react';

export const useEntityStoreRoutes = () => {
const http = useKibana().services.http;

return useMemo(() => {
const initEntityStore = async (entityType: EntityType) => {
return http.fetch<InitEntityEngineResponse>(`/api/entity_store/engines/${entityType}/init`, {
method: 'POST',
version: API_VERSIONS.public.v1,
body: JSON.stringify({}),
});
};

const stopEntityStore = async (entityType: EntityType) => {
return http.fetch<StopEntityEngineResponse>(`/api/entity_store/engines/${entityType}/stop`, {
method: 'POST',
version: API_VERSIONS.public.v1,
body: JSON.stringify({}),
});
};

const getEntityEngine = async (entityType: EntityType) => {
return http.fetch<GetEntityEngineResponse>(`/api/entity_store/engines/${entityType}`, {
method: 'GET',
version: API_VERSIONS.public.v1,
});
};

const deleteEntityEngine = async (entityType: EntityType) => {
return http.fetch<DeleteEntityEngineResponse>(`/api/entity_store/engines/${entityType}`, {
method: 'DELETE',
version: API_VERSIONS.public.v1,
});
};

const listEntityEngines = async () => {
return http.fetch<ListEntityEnginesResponse>(`/api/entity_store/engines`, {
method: 'GET',
version: API_VERSIONS.public.v1,
});
};

return {
initEntityStore,
stopEntityStore,
getEntityEngine,
deleteEntityEngine,
listEntityEngines,
};
}, [http]);
};
Loading

0 comments on commit 58b2c6e

Please sign in to comment.