[8.19] [AI4SOC] Added AI4SOC promotion rules bootstrapping (#217517)#223896
Merged
xcrzx merged 2 commits intoelastic:8.19from Jun 16, 2025
Merged
[8.19] [AI4SOC] Added AI4SOC promotion rules bootstrapping (#217517)#223896xcrzx merged 2 commits intoelastic:8.19from
xcrzx merged 2 commits intoelastic:8.19from
Conversation
Contributor
💔 Build Failed
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History |
**Resolves: https://github.com/elastic/security-team/issues/12069** ## Summary Added logic to bootstrap (install, upgrade, and enable) prebuilt promotion rules required for AI4SOC to function. Summary of changes: - Bootstrapping logic now depends on the `externalDetections` (enabled for AI4SOC) and `detections` (enabled for all tiers except AI4SOC) product keys. - For `detections`, we install the prebuilt rules package and the endpoint package as usual, with no additional steps. - For `externalDetections`, we install the rules package and skip the endpoint package installation, but also install on behalf of the user all promotion rules for enabled integrations. - The rule bootstrapping algorithm works as follows: We check if any of the following integrations are installed: Splunk, Microsoft Sentinel, Google SecOps, SentinelOne, or CrowdStrike. For enabled integrations, we identify prebuilt rules associated with them (using the `related_integrations` field) that also have the `Promotion` tag. This defines the set of promotion rules to install. - For each rule in that set, we check if it needs to be installed or upgraded. If the rule is missing, it's installed and enabled by default. If it was previously installed and disabled, it remains disabled. Rules are enabled by default only during initial installation. - Any prebuilt rules that are installed but not considered promotion rules for enabled integrations are deleted from Kibana. - To create promotion rules, users must have at least the Alerting framework CRUD capability. If this capability is missing, an error is thrown. These errors are exposed in the UI to indicate that rule installation didn’t complete successfully. <img width="788" alt="image" src="https://github.com/user-attachments/assets/5d2a274b-3142-423d-8015-009253eba9d5" /> - The bootstrap endpoint API contract has been extended to support the above scenarios. The response now includes the number of rules modified during the bootstrap process and any encountered errors: ```json { "packages": [ { "name": "security_detection_engine", "version": "9.0.1", "status": "already_installed" } ], "rules": { "total": 5, "installed": 5, "updated": 0, "deleted": 0, "skipped": 0, "errors": [] } } ``` - Frontend cache invalidation logic has also been updated to refetch any cached rules if the bootstrap endpoint reports modifications. ### How to test Currently, there are no promotion rules in the prebuilt rules package, so there's no straightforward way to test rule bootstrapping without uploading a fake rules package: 1. Start Kibana in serverless mode with the following product configuration: ```yaml xpack.securitySolutionServerless.productTypes: [{ product_line: 'ai_soc', product_tier: 'search_ai_lake' }] ``` 2. Create a rules package archive that contains promotion rules or use this archive for testing https://drive.google.com/file/d/1mbx1gjNbcvknbbbopOOXmaIBVvZpVQHC/view?usp=sharing 3. Upload the rules archive to Kibana using the Fleet API: ``` curl -u elastic_serverless:changeme 'http://localhost:5601/api/fleet/epm/packages' \ -H 'content-type: application/zip' \ -H 'x-elastic-internal-origin: Kibana' \ -H 'kbn-xsrf: foo' \ --data-binary @security_detection_engine-9.10.3.zip ``` 3. Enable any of the available integrations, e.g. Crowdstrike 3. Verify that the rules related to the integration were installed (that should happen automatically on navigation on any of Security pages) and enabled. Note that there's no UI for rules yet so it is only possible to read the rules using API (cherry picked from commit 98fa0f8) # Conflicts: # x-pack/solutions/security/plugins/security_solution/common/constants.ts # x-pack/solutions/security/plugins/security_solution/public/detections/hooks/alert_summary/use_fetch_integrations.ts # x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/api/bootstrap_prebuilt_rules/bootstrap_prebuilt_rules_handler.ts # x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/api/install_prebuilt_rules_and_timelines/install_prebuilt_rules_package.ts # x-pack/solutions/security/plugins/security_solution/server/lib/detection_engine/routes/__mocks__/request_context.ts # x-pack/solutions/security/plugins/security_solution/server/types.ts # x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/prebuilt_rule_customization/customization_enabled/is_customized_calculation.ts
c83ec8e to
6242bb9
Compare
kgeller
approved these changes
Jun 16, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.19:Questions ?
Please refer to the Backport tool documentation