-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security Solution] Allow prebuilt rules import and export #212509
base: main
Are you sure you want to change the base?
[Security Solution] Allow prebuilt rules import and export #212509
Conversation
8df69e5
to
d3e1af5
Compare
d3e1af5
to
08b9f1b
Compare
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.ftr_configs.yml
LGTM
@nikitaindik Can you please run all the new and changed tests via the flaky test runner? |
@@ -1626,6 +1626,7 @@ export default ({ getService }: FtrProviderContext): void => { | |||
describe('supporting prebuilt rule customization', () => { | |||
describe('compatibility with prebuilt rule fields', () => { | |||
it('rejects rules with "immutable: true" when the feature flag is disabled', async () => { | |||
// duplicate test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove it then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, good catch! This was a note to myself that I forgot to handle :)
const ruleAlertTypes = prebuiltRulesCustomizationEnabled | ||
? await getRules({ rulesClient, filter: '' }) | ||
: await getNonPackagedRules({ rulesClient }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
...t_suites/detections_response/rules_management/rule_bulk_actions/export/bulk_action_export.ts
Outdated
Show resolved
Hide resolved
await deleteAllPrebuiltRuleAssets(es, log); | ||
}); | ||
|
||
it(`exports prebuilt rules if the feature flag is enabled`, async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it(`exports prebuilt rules if the feature flag is enabled`, async () => { | |
it(`exports prebuilt rules`, async () => { |
await deleteAllPrebuiltRuleAssets(es, log); | ||
}); | ||
|
||
it(`does NOT import customized prebuilt rules when feature flag is disabled`, async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it(`does NOT import customized prebuilt rules when feature flag is disabled`, async () => { | |
it(`does NOT import customized prebuilt rules when rule customization is disabled`, async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the changes locally and found a few issues with Export buttons disabled in UI
1. FF enabled, sufficient license
- 🟢 Prebuilt rules can be exported
- 🟢 Customized rules can be imported
- 🟢 Non-customized rules can be imported
2. FF enabled, insufficient license
- 🔴 Prebuilt rules cannot be exported, the export option is disabled. It should be enabled
- 🟡 Customized rules cannot be imported. This is expected, but the error message should be more clear saying that the rule cannot be imported because it is Modified
- 🟢 Non-customized rules can be imported
3. FF disabled, sufficient license
Thanks for review and testing, @xcrzx! As discussed I've reverted the exporting behaviour to only allow exporting if the feature flag is disabled. Also, I've addressed your feedback, so feel free to do another review pass. |
💔 Build Failed
Failed CI StepsHistory
cc @nikitaindik |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7987[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/import_customized_prebuilt_rules/feature_disabled/configs/ess_feature_flag_disabled.config.ts: 50/50 tests passed. |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7986[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/import_non_customized_prebuilt_rules/feature_enabled/configs/ess_basic_license.config.ts: 50/50 tests passed. |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#7985[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/import_customized_prebuilt_rules/feature_disabled/configs/serverless_feature_flag_disabled.config.ts: 50/50 tests passed. |
Flaky Test Runner Stats🟠 Some tests failed. - kibana-flaky-test-suite-runner#7984[✅] x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_import_export/import_non_customized_prebuilt_rules/feature_enabled/configs/serverless_essentials_tier.config.ts: 50/50 tests passed. |
Resolves: https://github.com/elastic/security-team/issues/11502 (internal)
This PR implements following changes and adds API integration tests for them:
Flaky test runner (had to create 4 separate runs to test all configs):