…223896)
# Backport
This will backport the following commits from `main` to `8.19`:
- [[AI4SOC] Added AI4SOC promotion rules bootstrapping
(#217517)](#217517)
<!--- Backport version: 10.0.0 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Dmitrii
Shevchenko","email":"dmitrii.shevchenko@elastic.co"},"sourceCommit":{"committedDate":"2025-04-23T13:52:20Z","message":"[AI4SOC]
Added AI4SOC promotion rules bootstrapping (#217517)\n\n**Resolves:
https://github.com/elastic/security-team/issues/12069**\n\n##
Summary\n\nAdded logic to bootstrap (install, upgrade, and enable)
prebuilt\npromotion rules required for AI4SOC to function.\n\nSummary of
changes:\n\n- Bootstrapping logic now depends on the
`externalDetections` (enabled\nfor AI4SOC) and `detections` (enabled for
all tiers except AI4SOC)\nproduct keys.\n- For `detections`, we install
the prebuilt rules package and the\nendpoint package as usual, with no
additional steps.\n- For `externalDetections`, we install the rules
package and skip the\nendpoint package installation, but also install on
behalf of the user\nall promotion rules for enabled integrations.\n- The
rule bootstrapping algorithm works as follows: \nWe check if any of the
following integrations are installed: Splunk,\nMicrosoft Sentinel,
Google SecOps, SentinelOne, or CrowdStrike. For\nenabled integrations,
we identify prebuilt rules associated with them\n(using the
`related_integrations` field) that also have the `Promotion`\ntag. This
defines the set of promotion rules to install.\n- For each rule in that
set, we check if it needs to be installed or\nupgraded. If the rule is
missing, it's installed and enabled by default.\nIf it was previously
installed and disabled, it remains disabled. Rules\nare enabled by
default only during initial installation.\n- Any prebuilt rules that are
installed but not considered promotion\nrules for enabled integrations
are deleted from Kibana.\n- To create promotion rules, users must have
at least the Alerting\nframework CRUD capability. If this capability is
missing, an error is\nthrown. These errors are exposed in the UI to
indicate that rule\ninstallation didn’t complete successfully.\n<img
width=\"788\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5d2a274b-3142-423d-8015-009253eba9d5\"\n/>\n-
The bootstrap endpoint API contract has been extended to support
the\nabove scenarios. The response now includes the number of rules
modified\nduring the bootstrap process and any encountered errors:\n
```json\n {\n \"packages\": [\n {\n \"name\":
\"security_detection_engine\",\n \"version\": \"9.0.1\",\n \"status\":
\"already_installed\"\n }\n ],\n \"rules\": {\n \"total\": 5,\n
\"installed\": 5,\n \"updated\": 0,\n \"deleted\": 0,\n \"skipped\":
0,\n \"errors\": []\n }\n }\n ```\n- Frontend cache invalidation logic
has also been updated to refetch any\ncached rules if the bootstrap
endpoint reports modifications.\n\n### How to test\n\nCurrently, there
are no promotion rules in the prebuilt rules package,\nso there's no
straightforward way to test rule bootstrapping without\nuploading a fake
rules package:\n\n1. Start Kibana in serverless mode with the following
product\nconfiguration:\n ```yaml\n
xpack.securitySolutionServerless.productTypes:\n [{ product_line:
'ai_soc', product_tier: 'search_ai_lake' }]\n ```\n2. Create a rules
package archive that contains promotion rules or use\nthis archive for
testing\nhttps://drive.google.com/file/d/1mbx1gjNbcvknbbbopOOXmaIBVvZpVQHC/view?usp=sharing\n3.
Upload the rules archive to Kibana using the Fleet API:\n ```\ncurl -u
elastic_serverless:changeme\n'http://localhost:5601/api/fleet/epm/packages'
\\\n -H 'content-type: application/zip' \\\n -H
'x-elastic-internal-origin: Kibana' \\\n -H 'kbn-xsrf: foo' \\\n
--data-binary @security_detection_engine-9.10.3.zip\n ```\n3. Enable any
of the available integrations, e.g. Crowdstrike\n3. Verify that the
rules related to the integration were installed (that\nshould happen
automatically on navigation on any of Security pages) and\nenabled. Note
that there's no UI for rules yet so it is only possible to\nread the
rules using
API","sha":"98fa0f8ef4accc7fa501fb5d7f66dab5c9668769","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","Team:Detections and Resp","Team:
SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt
Detection
Rules","backport:version","v9.1.0","v8.19.0"],"title":"[AI4SOC] Added
AI4SOC promotion rules
bootstrapping","number":217517,"url":"https://github.com/elastic/kibana/pull/217517","mergeCommit":{"message":"[AI4SOC]
Added AI4SOC promotion rules bootstrapping (#217517)\n\n**Resolves:
https://github.com/elastic/security-team/issues/12069**\n\n##
Summary\n\nAdded logic to bootstrap (install, upgrade, and enable)
prebuilt\npromotion rules required for AI4SOC to function.\n\nSummary of
changes:\n\n- Bootstrapping logic now depends on the
`externalDetections` (enabled\nfor AI4SOC) and `detections` (enabled for
all tiers except AI4SOC)\nproduct keys.\n- For `detections`, we install
the prebuilt rules package and the\nendpoint package as usual, with no
additional steps.\n- For `externalDetections`, we install the rules
package and skip the\nendpoint package installation, but also install on
behalf of the user\nall promotion rules for enabled integrations.\n- The
rule bootstrapping algorithm works as follows: \nWe check if any of the
following integrations are installed: Splunk,\nMicrosoft Sentinel,
Google SecOps, SentinelOne, or CrowdStrike. For\nenabled integrations,
we identify prebuilt rules associated with them\n(using the
`related_integrations` field) that also have the `Promotion`\ntag. This
defines the set of promotion rules to install.\n- For each rule in that
set, we check if it needs to be installed or\nupgraded. If the rule is
missing, it's installed and enabled by default.\nIf it was previously
installed and disabled, it remains disabled. Rules\nare enabled by
default only during initial installation.\n- Any prebuilt rules that are
installed but not considered promotion\nrules for enabled integrations
are deleted from Kibana.\n- To create promotion rules, users must have
at least the Alerting\nframework CRUD capability. If this capability is
missing, an error is\nthrown. These errors are exposed in the UI to
indicate that rule\ninstallation didn’t complete successfully.\n<img
width=\"788\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5d2a274b-3142-423d-8015-009253eba9d5\"\n/>\n-
The bootstrap endpoint API contract has been extended to support
the\nabove scenarios. The response now includes the number of rules
modified\nduring the bootstrap process and any encountered errors:\n
```json\n {\n \"packages\": [\n {\n \"name\":
\"security_detection_engine\",\n \"version\": \"9.0.1\",\n \"status\":
\"already_installed\"\n }\n ],\n \"rules\": {\n \"total\": 5,\n
\"installed\": 5,\n \"updated\": 0,\n \"deleted\": 0,\n \"skipped\":
0,\n \"errors\": []\n }\n }\n ```\n- Frontend cache invalidation logic
has also been updated to refetch any\ncached rules if the bootstrap
endpoint reports modifications.\n\n### How to test\n\nCurrently, there
are no promotion rules in the prebuilt rules package,\nso there's no
straightforward way to test rule bootstrapping without\nuploading a fake
rules package:\n\n1. Start Kibana in serverless mode with the following
product\nconfiguration:\n ```yaml\n
xpack.securitySolutionServerless.productTypes:\n [{ product_line:
'ai_soc', product_tier: 'search_ai_lake' }]\n ```\n2. Create a rules
package archive that contains promotion rules or use\nthis archive for
testing\nhttps://drive.google.com/file/d/1mbx1gjNbcvknbbbopOOXmaIBVvZpVQHC/view?usp=sharing\n3.
Upload the rules archive to Kibana using the Fleet API:\n ```\ncurl -u
elastic_serverless:changeme\n'http://localhost:5601/api/fleet/epm/packages'
\\\n -H 'content-type: application/zip' \\\n -H
'x-elastic-internal-origin: Kibana' \\\n -H 'kbn-xsrf: foo' \\\n
--data-binary @security_detection_engine-9.10.3.zip\n ```\n3. Enable any
of the available integrations, e.g. Crowdstrike\n3. Verify that the
rules related to the integration were installed (that\nshould happen
automatically on navigation on any of Security pages) and\nenabled. Note
that there's no UI for rules yet so it is only possible to\nread the
rules using
API","sha":"98fa0f8ef4accc7fa501fb5d7f66dab5c9668769"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217517","number":217517,"mergeCommit":{"message":"[AI4SOC]
Added AI4SOC promotion rules bootstrapping (#217517)\n\n**Resolves:
https://github.com/elastic/security-team/issues/12069**\n\n##
Summary\n\nAdded logic to bootstrap (install, upgrade, and enable)
prebuilt\npromotion rules required for AI4SOC to function.\n\nSummary of
changes:\n\n- Bootstrapping logic now depends on the
`externalDetections` (enabled\nfor AI4SOC) and `detections` (enabled for
all tiers except AI4SOC)\nproduct keys.\n- For `detections`, we install
the prebuilt rules package and the\nendpoint package as usual, with no
additional steps.\n- For `externalDetections`, we install the rules
package and skip the\nendpoint package installation, but also install on
behalf of the user\nall promotion rules for enabled integrations.\n- The
rule bootstrapping algorithm works as follows: \nWe check if any of the
following integrations are installed: Splunk,\nMicrosoft Sentinel,
Google SecOps, SentinelOne, or CrowdStrike. For\nenabled integrations,
we identify prebuilt rules associated with them\n(using the
`related_integrations` field) that also have the `Promotion`\ntag. This
defines the set of promotion rules to install.\n- For each rule in that
set, we check if it needs to be installed or\nupgraded. If the rule is
missing, it's installed and enabled by default.\nIf it was previously
installed and disabled, it remains disabled. Rules\nare enabled by
default only during initial installation.\n- Any prebuilt rules that are
installed but not considered promotion\nrules for enabled integrations
are deleted from Kibana.\n- To create promotion rules, users must have
at least the Alerting\nframework CRUD capability. If this capability is
missing, an error is\nthrown. These errors are exposed in the UI to
indicate that rule\ninstallation didn’t complete successfully.\n<img
width=\"788\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/5d2a274b-3142-423d-8015-009253eba9d5\"\n/>\n-
The bootstrap endpoint API contract has been extended to support
the\nabove scenarios. The response now includes the number of rules
modified\nduring the bootstrap process and any encountered errors:\n
```json\n {\n \"packages\": [\n {\n \"name\":
\"security_detection_engine\",\n \"version\": \"9.0.1\",\n \"status\":
\"already_installed\"\n }\n ],\n \"rules\": {\n \"total\": 5,\n
\"installed\": 5,\n \"updated\": 0,\n \"deleted\": 0,\n \"skipped\":
0,\n \"errors\": []\n }\n }\n ```\n- Frontend cache invalidation logic
has also been updated to refetch any\ncached rules if the bootstrap
endpoint reports modifications.\n\n### How to test\n\nCurrently, there
are no promotion rules in the prebuilt rules package,\nso there's no
straightforward way to test rule bootstrapping without\nuploading a fake
rules package:\n\n1. Start Kibana in serverless mode with the following
product\nconfiguration:\n ```yaml\n
xpack.securitySolutionServerless.productTypes:\n [{ product_line:
'ai_soc', product_tier: 'search_ai_lake' }]\n ```\n2. Create a rules
package archive that contains promotion rules or use\nthis archive for
testing\nhttps://drive.google.com/file/d/1mbx1gjNbcvknbbbopOOXmaIBVvZpVQHC/view?usp=sharing\n3.
Upload the rules archive to Kibana using the Fleet API:\n ```\ncurl -u
elastic_serverless:changeme\n'http://localhost:5601/api/fleet/epm/packages'
\\\n -H 'content-type: application/zip' \\\n -H
'x-elastic-internal-origin: Kibana' \\\n -H 'kbn-xsrf: foo' \\\n
--data-binary @security_detection_engine-9.10.3.zip\n ```\n3. Enable any
of the available integrations, e.g. Crowdstrike\n3. Verify that the
rules related to the integration were installed (that\nshould happen
automatically on navigation on any of Security pages) and\nenabled. Note
that there's no UI for rules yet so it is only possible to\nread the
rules using
API","sha":"98fa0f8ef4accc7fa501fb5d7f66dab5c9668769"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
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:
externalDetections(enabled for AI4SOC) anddetections(enabled for all tiers except AI4SOC) product keys.detections, we install the prebuilt rules package and the endpoint package as usual, with no additional steps.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.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_integrationsfield) that also have thePromotiontag. This defines the set of promotion rules to install.{ "packages": [ { "name": "security_detection_engine", "version": "9.0.1", "status": "already_installed" } ], "rules": { "total": 5, "installed": 5, "updated": 0, "deleted": 0, "skipped": 0, "errors": [] } }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: