-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Entity Analytics] Move routes and constants into folders owned by th…
…e entity analytics team (#180702) ## Summary Closes #180531 This pull request moves entity analytics route registration and url definition into files owned by our team. Currently, to add a new route we require a code owners review from both the `security-detections-response` and `security-threat-hunting` teams unnecessarily. This is because we needed to change the following files: - `x-pack/plugins/security_solution/common/constants.ts` - `x-pack/plugins/security_solution/server/routes/index.ts` As recommended by @maximpn [here](#179930 (review)) I have also removed redundant feature flag checks for enabling risk scoring and risk engine privileges routes, these feature flags are enabled now. --------- Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
bf73f17
commit 47582c4
Showing
29 changed files
with
204 additions
and
149 deletions.
There are no files selected for viewing
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
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/security_solution/common/entity_analytics/constants.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. | ||
*/ | ||
|
||
export * from './asset_criticality/constants'; | ||
export * from './risk_engine/constants'; | ||
export * from './risk_score/constants'; |
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
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/security_solution/common/entity_analytics/risk_score/constants.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,31 @@ | ||
/* | ||
* 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. | ||
*/ | ||
/** | ||
* Public Risk Score routes | ||
*/ | ||
export const RISK_ENGINE_PUBLIC_PREFIX = '/api/risk_scores' as const; | ||
export const RISK_SCORE_CALCULATION_URL = `${RISK_ENGINE_PUBLIC_PREFIX}/calculation` as const; | ||
|
||
/** | ||
* Internal Risk Score routes | ||
*/ | ||
export const INTERNAL_RISK_SCORE_URL = '/internal/risk_score' as const; | ||
export const DEV_TOOL_PREBUILT_CONTENT = | ||
`${INTERNAL_RISK_SCORE_URL}/prebuilt_content/dev_tool/{console_id}` as const; | ||
export const devToolPrebuiltContentUrl = (spaceId: string, consoleId: string) => | ||
`/s/${spaceId}${INTERNAL_RISK_SCORE_URL}/prebuilt_content/dev_tool/${consoleId}` as const; | ||
export const PREBUILT_SAVED_OBJECTS_BULK_CREATE = `${INTERNAL_RISK_SCORE_URL}/prebuilt_content/saved_objects/_bulk_create/{template_name}`; | ||
export const prebuiltSavedObjectsBulkCreateUrl = (templateName: string) => | ||
`${INTERNAL_RISK_SCORE_URL}/prebuilt_content/saved_objects/_bulk_create/${templateName}` as const; | ||
export const PREBUILT_SAVED_OBJECTS_BULK_DELETE = `${INTERNAL_RISK_SCORE_URL}/prebuilt_content/saved_objects/_bulk_delete/{template_name}`; | ||
export const prebuiltSavedObjectsBulkDeleteUrl = (templateName: string) => | ||
`${INTERNAL_RISK_SCORE_URL}/prebuilt_content/saved_objects/_bulk_delete/${templateName}` as const; | ||
export const RISK_SCORE_CREATE_INDEX = `${INTERNAL_RISK_SCORE_URL}/indices/create`; | ||
export const RISK_SCORE_DELETE_INDICES = `${INTERNAL_RISK_SCORE_URL}/indices/delete`; | ||
export const RISK_SCORE_CREATE_STORED_SCRIPT = `${INTERNAL_RISK_SCORE_URL}/stored_scripts/create`; | ||
export const RISK_SCORE_DELETE_STORED_SCRIPT = `${INTERNAL_RISK_SCORE_URL}/stored_scripts/delete`; | ||
export const RISK_SCORE_PREVIEW_URL = `${INTERNAL_RISK_SCORE_URL}/preview`; |
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
27 changes: 27 additions & 0 deletions
27
...server/lib/entity_analytics/asset_criticality/routes/register_asset_criticality_routes.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,27 @@ | ||
/* | ||
* 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 { assetCriticalityStatusRoute } from './status'; | ||
import { assetCriticalityUpsertRoute } from './upsert'; | ||
import { assetCriticalityGetRoute } from './get'; | ||
import { assetCriticalityDeleteRoute } from './delete'; | ||
import { assetCriticalityPrivilegesRoute } from './privileges'; | ||
import { assetCriticalityCSVUploadRoute } from './upload_csv'; | ||
import type { EntityAnalyticsRoutesDeps } from '../../types'; | ||
|
||
export const registerAssetCriticalityRoutes = ({ | ||
router, | ||
logger, | ||
config, | ||
getStartServices, | ||
}: EntityAnalyticsRoutesDeps) => { | ||
assetCriticalityStatusRoute(router, logger); | ||
assetCriticalityUpsertRoute(router, logger); | ||
assetCriticalityGetRoute(router, logger); | ||
assetCriticalityDeleteRoute(router, logger); | ||
assetCriticalityPrivilegesRoute(router, logger, getStartServices); | ||
assetCriticalityCSVUploadRoute(router, logger, config, getStartServices); | ||
}; |
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
17 changes: 17 additions & 0 deletions
17
...plugins/security_solution/server/lib/entity_analytics/register_entity_analytics_routes.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,17 @@ | ||
/* | ||
* 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 { registerAssetCriticalityRoutes } from './asset_criticality/routes'; | ||
import { registerRiskScoreRoutes } from './risk_score/routes'; | ||
import { registerRiskEngineRoutes } from './risk_engine/routes'; | ||
import type { EntityAnalyticsRoutesDeps } from './types'; | ||
|
||
export const registerEntityAnalyticsRoutes = (routeDeps: EntityAnalyticsRoutesDeps) => { | ||
registerAssetCriticalityRoutes(routeDeps); | ||
registerRiskScoreRoutes(routeDeps); | ||
registerRiskEngineRoutes(routeDeps); | ||
}; |
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.