-
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.
[Serverless][Security Solution][Endpoint] Restrict endpoint exception…
…s on serverless via plugin sub-features (#164107) ### What this PR changes branched from /pull/163759 - Introduces new AppFeatures package `@kbn/security-solution-features` with the common logic and `AppFeatureService` to apply offering specific configurations for Security Solution features independently for Serverless and ESS. This logic is replacing the earlier `AppFeatures` in order to introduce new Kibana feature privileges for serverless PLIs so that new Kibana privileges introduced for serverless PLIs do not affect/show up as new Kibana feature privileges in ESS. - Gates endpoint exceptions on alerts/rules based on serverless PLI configurations. On serverless `Endpoint exceptions` should be accessible/seen only on endpoint essentials/complete. New AppFeatures logic architecture diagram: ![Security Solution Features (Current)](https://github.com/elastic/kibana/assets/17747913/f627406d-43bc-4db5-93b1-4e43eeb6d870) **Note:** Corresponding API changes related to endpoint exceptions will be in a new PR, along with the last set of UX changes for hiding the `Endpoint exceptions` tab from the Rules details page. ### How to review - Setup for _Servlerless_ - Run `yarn es snapshot` on a terminal window to start ES. - Copy `config/serverless.security.yml` to `config/serverless.security.dev.yml` - Run `yarn serverless-security --no-base-path` on another terminal window to start kibana in serverless mode - Run `node x-pack/plugins/security_solution/scripts/endpoint/endpoint_agent_emulator.js --asSuperuser` on a new window and then select `1` to `Load Endoints` and then `1` to `Run` the loader script. This will load some fake agents/alerts data to test with. ### Tests (Serverless) - with `{ product_line: 'security', product_tier: 'essentials' }` or `{ product_line: 'security', product_tier: 'complete' }` and `{ product_line: 'endpoint', product_tier: 'essentials' }` or `{ product_line: 'endpoint', product_tier: 'complete' }` 1. Navigate to Rules>Shared exception lists via `http://localhost:5601/app/security/exceptions` 2. Test that you can see `Endpoint Security Exception List` card on the shared exception lists page. 3. Navigate to `Alerts` page via `app/security/alerts`, you should see endpoint alerts. If not, then click on `Manage Rules` and then disable/enable `Endpoint Security` rules. That should trigger alerts to show up on the Alerts table. 4. Click on `View Details` button under `Actions` column. Once the flyout is visible, click on `Take Action` and verify that `Add Endpoint exception` is visible/enabled/clickable on the menu. 5. Click on `More actions` button under `Actions` column and verify that `Add Endpoint exception` is visible/enabled/clickable on the menu. 6. Click on `Investigate in timeline` button under `Actions` column; when the timeline view is visible and the alert item is displayed, click on buttons mentioned in 4. and 5. above and verify the same. 7. Navigate to `Rules`>`DetectionRules`>`Endpoint Security` rule under the `Rules` table. Select the `Alerts` tab. 8. Click and verify `View details`,`More actions` and `Investigate in timeline` buttons same as in 4., 5., 6. above. 9. You should be able to see the `Endpoint exceptions` tab as well. Click and verify that you can see the tab's content. - with `{ product_line: 'security', product_tier: 'essentials' }` or `{ product_line: 'security', product_tier: 'complete' }` 1. Edit `config/serverless.security.dev.yml` so that `endpoint` product line item is commented out. 2. Test that you can not see `Endpoint Security Exception List` card on the shared exception lists page. 3. Items 4. 5. 6. as above but the menu items should be disabled. This can be verified with fake data only as with a real endpoint, endpoint alerts are actually not visible at all. ### Tests (ESS) On the ESS side, endpoint exceptions are not affected by this change and work as usual based on index privileges. --------- Co-authored-by: semd <[email protected]> Co-authored-by: kibanamachine <[email protected]> Co-authored-by: YulNaumenko <[email protected]> Co-authored-by: Pablo Neves Machado <[email protected]> Co-authored-by: Pablo Machado <[email protected]>
- Loading branch information
1 parent
73469bf
commit 6e367d9
Showing
107 changed files
with
2,197 additions
and
1,302 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
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## Security Solution App Features | ||
|
||
This package provides resources to be used for Security Solution app features | ||
|
10 changes: 10 additions & 0 deletions
10
x-pack/packages/security-solution/features/app_features.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 { getSecurityFeature } from './src/security'; | ||
export { getCasesFeature } from './src/cases'; | ||
export { getAssistantFeature } from './src/assistant'; |
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,12 @@ | ||
/* | ||
* 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 { securityDefaultAppFeaturesConfig } from './src/security/app_feature_config'; | ||
export { getCasesDefaultAppFeaturesConfig } from './src/cases/app_feature_config'; | ||
export { assistantDefaultAppFeaturesConfig } from './src/assistant/app_feature_config'; | ||
|
||
export { createEnabledAppFeaturesConfigMap } from './src/helpers'; |
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,7 @@ | ||
/* | ||
* 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 './src/types'; |
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,12 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test', | ||
rootDir: '../../../..', | ||
roots: ['<rootDir>/x-pack/packages/security-solution/features'], | ||
}; |
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
* 2.0. | ||
*/ | ||
|
||
export { AppFeatures } from './app_features'; | ||
export * from './src/app_features_keys'; |
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,5 @@ | ||
{ | ||
"type": "shared-common", | ||
"id": "@kbn/security-solution-features", | ||
"owner": "@elastic/security-threat-hunting-explore" | ||
} |
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,6 @@ | ||
{ | ||
"name": "@kbn/security-solution-features", | ||
"private": true, | ||
"version": "1.0.0", | ||
"license": "Elastic License 2.0" | ||
} |
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,7 @@ | ||
/* | ||
* 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 { AppFeaturesPrivilegeId, AppFeaturesPrivileges } from './src/app_features_privileges'; |
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
30 changes: 30 additions & 0 deletions
30
x-pack/packages/security-solution/features/src/app_features_privileges.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,30 @@ | ||
/* | ||
* 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 { APP_ID } from './constants'; | ||
|
||
export enum AppFeaturesPrivilegeId { | ||
endpointExceptions = 'endpoint_exceptions', | ||
} | ||
|
||
/** | ||
* This is the mapping of the privileges that are registered | ||
* using a different Kibana feature configuration (sub-feature, main feature privilege, etc) | ||
* in each offering type (ess, serverless) | ||
*/ | ||
export const AppFeaturesPrivileges = { | ||
[AppFeaturesPrivilegeId.endpointExceptions]: { | ||
all: { | ||
ui: ['showEndpointExceptions', 'crudEndpointExceptions'], | ||
api: [`${APP_ID}-showEndpointExceptions`, `${APP_ID}-crudEndpointExceptions`], | ||
}, | ||
read: { | ||
ui: ['showEndpointExceptions'], | ||
api: [`${APP_ID}-showEndpointExceptions`], | ||
}, | ||
}, | ||
}; |
33 changes: 33 additions & 0 deletions
33
x-pack/packages/security-solution/features/src/assistant/app_feature_config.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,33 @@ | ||
/* | ||
* 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 { AssistantSubFeatureId } from '../app_features_keys'; | ||
import { AppFeatureAssistantKey } from '../app_features_keys'; | ||
import type { AppFeatureKibanaConfig } from '../types'; | ||
|
||
/** | ||
* App features privileges configuration for the Security Assistant Kibana Feature app. | ||
* These are the configs that are shared between both offering types (ess and serverless). | ||
* They can be extended on each offering plugin to register privileges using different way on each offering type. | ||
* | ||
* Privileges can be added in different ways: | ||
* - `privileges`: the privileges that will be added directly into the main Security feature. | ||
* - `subFeatureIds`: the ids of the sub-features that will be added into the Security subFeatures entry. | ||
* - `subFeaturesPrivileges`: the privileges that will be added into the existing Security subFeature with the privilege `id` specified. | ||
*/ | ||
export const assistantDefaultAppFeaturesConfig: Record< | ||
AppFeatureAssistantKey, | ||
AppFeatureKibanaConfig<AssistantSubFeatureId> | ||
> = { | ||
[AppFeatureAssistantKey.assistant]: { | ||
privileges: { | ||
all: { | ||
ui: ['ai-assistant'], | ||
}, | ||
}, | ||
}, | ||
}; |
19 changes: 19 additions & 0 deletions
19
x-pack/packages/security-solution/features/src/assistant/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,19 @@ | ||
/* | ||
* 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 { AssistantSubFeatureId } from '../app_features_keys'; | ||
import type { AppFeatureParams } from '../types'; | ||
import { getAssistantBaseKibanaFeature } from './kibana_features'; | ||
import { | ||
getAssistantBaseKibanaSubFeatureIds, | ||
assistantSubFeaturesMap, | ||
} from './kibana_sub_features'; | ||
|
||
export const getAssistantFeature = (): AppFeatureParams<AssistantSubFeatureId> => ({ | ||
baseKibanaFeature: getAssistantBaseKibanaFeature(), | ||
baseKibanaSubFeatureIds: getAssistantBaseKibanaSubFeatureIds(), | ||
subFeaturesMap: assistantSubFeaturesMap, | ||
}); |
48 changes: 48 additions & 0 deletions
48
x-pack/packages/security-solution/features/src/assistant/kibana_features.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,48 @@ | ||
/* | ||
* 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 { i18n } from '@kbn/i18n'; | ||
|
||
import { DEFAULT_APP_CATEGORIES } from '@kbn/core-application-common'; | ||
import { type BaseKibanaFeatureConfig } from '../types'; | ||
import { APP_ID, ASSISTANT_FEATURE_ID } from '../constants'; | ||
|
||
export const getAssistantBaseKibanaFeature = (): BaseKibanaFeatureConfig => ({ | ||
id: ASSISTANT_FEATURE_ID, | ||
name: i18n.translate( | ||
'securitySolutionPackages.features.featureRegistry.linkSecuritySolutionAssistantTitle', | ||
{ | ||
defaultMessage: 'Elastic AI Assistant', | ||
} | ||
), | ||
order: 1100, | ||
category: DEFAULT_APP_CATEGORIES.security, | ||
app: [ASSISTANT_FEATURE_ID, 'kibana'], | ||
catalogue: [APP_ID], | ||
minimumLicense: 'enterprise', | ||
privileges: { | ||
all: { | ||
api: [], | ||
app: [ASSISTANT_FEATURE_ID, 'kibana'], | ||
catalogue: [APP_ID], | ||
savedObject: { | ||
all: [], | ||
read: [], | ||
}, | ||
ui: [], | ||
}, | ||
read: { | ||
// No read-only mode currently supported | ||
disabled: true, | ||
savedObject: { | ||
all: [], | ||
read: [], | ||
}, | ||
ui: [], | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.