-
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.
[Security Solution][Detection Engine] adds rule actions PLI (#168510)
## Summary - implements the first phase of [rule external actions Serverless PLI](https://docs.google.com/spreadsheets/d/1BR9kjzSR0F6o6huxbJidk5ro4CVYfhmLog9ArEbxA8g/edit#gid=301346322). Phase 1 is defined by support of PLI capabilities in actions plugins and described [here](#163751). It allows only hiding actions that are not in tier. Upselling messages, will be introduced in phase 2, according to response ops ticket ### Essentials Tier Serverless config: ```yaml xpack.securitySolutionServerless.productTypes: [ { product_line: 'security', product_tier: 'essentials' }, { product_line: 'endpoint', product_tier: 'complete' }, ] ``` For Essentials, only 3 rule actions available: - email - index - slack <img width="2525" alt="Screenshot 2023-10-11 at 11 13 57" src="https://github.com/elastic/kibana/assets/92328789/2a10d077-3090-494d-953f-2880c2afdccf"> ### Complete Tier Serverless config: ```yaml xpack.securitySolutionServerless.productTypes: [ { product_line: 'security', product_tier: 'complete' }, { product_line: 'endpoint', product_tier: 'complete' }, ] ``` <img width="2530" alt="Screenshot 2023-10-11 at 11 17 10" src="https://github.com/elastic/kibana/assets/92328789/1e5912a5-a358-409b-8fd6-e526e047fe54"> ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
3f6872d
commit 94284a1
Showing
11 changed files
with
213 additions
and
3 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
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
40 changes: 40 additions & 0 deletions
40
x-pack/plugins/security_solution_serverless/server/rules/enable_rule_actions.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,40 @@ | ||
/* | ||
* 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 { AppFeatureSecurityKey } from '@kbn/security-solution-features/keys'; | ||
import { | ||
IndexConnectorTypeId, | ||
SlackWebhookConnectorTypeId, | ||
EmailConnectorTypeId, | ||
} from '@kbn/stack-connectors-plugin/server/connector_types'; | ||
import { EnabledActionTypes } from '@kbn/actions-plugin/server/config'; | ||
import type { AppFeatureKeys } from '@kbn/security-solution-features/src/types'; | ||
|
||
import type { PluginSetupContract as ActionsPluginSetupContract } from '@kbn/actions-plugin/server'; | ||
|
||
const INTERNAL_RULE_ACTIONS = [ | ||
IndexConnectorTypeId, | ||
SlackWebhookConnectorTypeId, | ||
EmailConnectorTypeId, | ||
]; | ||
|
||
/** | ||
* enable rule actions based on AppFeature Config | ||
*/ | ||
export const enableRuleActions = ({ | ||
actions, | ||
appFeatureKeys, | ||
}: { | ||
actions: ActionsPluginSetupContract; | ||
appFeatureKeys: AppFeatureKeys; | ||
}) => { | ||
if (appFeatureKeys.includes(AppFeatureSecurityKey.externalRuleActions)) { | ||
// enables all rule actions | ||
actions.setEnabledConnectorTypes([EnabledActionTypes.Any]); | ||
} else { | ||
actions.setEnabledConnectorTypes(INTERNAL_RULE_ACTIONS); | ||
} | ||
}; |
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
72 changes: 72 additions & 0 deletions
72
...ution_cypress/cypress/e2e/detection_response/rule_actions/rule_actions_pli_complete.cy.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,72 @@ | ||
/* | ||
* 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 { getNewRule } from '../../../objects/rule'; | ||
|
||
import { | ||
INDEX_SELECTOR, | ||
SLACK_ACTION_BTN, | ||
WEBHOOK_ACTION_BTN, | ||
EMAIL_ACTION_BTN, | ||
ACTION_BTN, | ||
} from '../../../screens/common/rule_actions'; | ||
|
||
import { createRule } from '../../../tasks/api_calls/rules'; | ||
|
||
import { RULES_MANAGEMENT_URL } from '../../../urls/rules_management'; | ||
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common'; | ||
import { goToActionsStepTab } from '../../../tasks/create_new_rule'; | ||
import { login } from '../../../tasks/login'; | ||
|
||
import { editFirstRule } from '../../../tasks/alerts_detection_rules'; | ||
|
||
import { visit } from '../../../tasks/navigation'; | ||
|
||
const rule = getNewRule(); | ||
|
||
describe( | ||
'Rule actions PLI complete product tier', | ||
{ | ||
tags: ['@serverless'], | ||
|
||
env: { | ||
ftrConfig: { | ||
productTypes: [ | ||
{ product_line: 'security', product_tier: 'complete' }, | ||
{ product_line: 'endpoint', product_tier: 'complete' }, | ||
], | ||
}, | ||
}, | ||
}, | ||
() => { | ||
before(() => { | ||
cleanKibana(); | ||
login(); | ||
}); | ||
|
||
beforeEach(() => { | ||
deleteAlertsAndRules(); | ||
createRule(rule); | ||
login(); | ||
}); | ||
|
||
it('more than 3 rule actions should be available', () => { | ||
visit(RULES_MANAGEMENT_URL); | ||
editFirstRule(); | ||
|
||
goToActionsStepTab(); | ||
|
||
// all actions available | ||
cy.get(ACTION_BTN).should('have.length.greaterThan', 4); | ||
|
||
cy.get(INDEX_SELECTOR).should('be.visible'); | ||
cy.get(SLACK_ACTION_BTN).should('be.visible'); | ||
cy.get(EMAIL_ACTION_BTN).should('be.visible'); | ||
cy.get(WEBHOOK_ACTION_BTN).should('be.visible'); | ||
}); | ||
} | ||
); |
74 changes: 74 additions & 0 deletions
74
...ion_cypress/cypress/e2e/detection_response/rule_actions/rule_actions_pli_essentials.cy.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,74 @@ | ||
/* | ||
* 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 { getNewRule } from '../../../objects/rule'; | ||
|
||
import { | ||
INDEX_SELECTOR, | ||
SLACK_ACTION_BTN, | ||
WEBHOOK_ACTION_BTN, | ||
EMAIL_ACTION_BTN, | ||
ACTION_BTN, | ||
} from '../../../screens/common/rule_actions'; | ||
|
||
import { createRule } from '../../../tasks/api_calls/rules'; | ||
|
||
import { RULES_MANAGEMENT_URL } from '../../../urls/rules_management'; | ||
import { cleanKibana, deleteAlertsAndRules } from '../../../tasks/common'; | ||
import { goToActionsStepTab } from '../../../tasks/create_new_rule'; | ||
import { login } from '../../../tasks/login'; | ||
|
||
import { editFirstRule } from '../../../tasks/alerts_detection_rules'; | ||
|
||
import { visit } from '../../../tasks/navigation'; | ||
|
||
const rule = getNewRule(); | ||
|
||
describe( | ||
'Rule actions PLI essentials product tier', | ||
{ | ||
tags: ['@serverless'], | ||
|
||
env: { | ||
ftrConfig: { | ||
productTypes: [ | ||
{ product_line: 'security', product_tier: 'essentials' }, | ||
{ product_line: 'endpoint', product_tier: 'essentials' }, | ||
], | ||
}, | ||
}, | ||
}, | ||
() => { | ||
before(() => { | ||
cleanKibana(); | ||
login(); | ||
}); | ||
|
||
beforeEach(() => { | ||
deleteAlertsAndRules(); | ||
createRule(rule); | ||
login(); | ||
}); | ||
|
||
it('only 3 rule actions should be available', () => { | ||
visit(RULES_MANAGEMENT_URL); | ||
editFirstRule(); | ||
|
||
goToActionsStepTab(); | ||
|
||
// only 3 basic actions available | ||
cy.get(ACTION_BTN).should('have.length', 3); | ||
|
||
cy.get(INDEX_SELECTOR).should('be.visible'); | ||
cy.get(SLACK_ACTION_BTN).should('be.visible'); | ||
cy.get(EMAIL_ACTION_BTN).should('be.visible'); | ||
|
||
// webhook is not available | ||
cy.get(WEBHOOK_ACTION_BTN).should('not.exist'); | ||
}); | ||
} | ||
); |
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