[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation#217959
Conversation
|
@xcrzx I completed the local testing:
|
|
Pinging @elastic/esecurity-onboarding-and-lifecycle-mgt (Feature:Endpoint) |
|
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) |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
History
cc @xcrzx |
|
Starting backport for target branches: 8.17, 8.18, 8.x, 9.0 https://github.com/elastic/kibana/actions/runs/14451777801 |
…cy creation (elastic#217959) **Resolves: https://github.com/elastic/security-team/issues/7216** ## Summary This PR updates the Endpoint policy callback to: - **Install only the Elastic Defend rule if it's missing**, without upgrading it to the latest version. Previously, the rule was both installed and updated whenever an Endpoint policy was created, which conflicted with rule customization. Automatic upgrades could erase existing user customizations. - **Avoid triggering the installation or upgrade of any other prebuilt rules** as part of this flow. The Endpoint package policy creation callback ([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187)) previously installed and upgraded **all** prebuilt detection rules to their target versions whenever an Endpoint policy was created. This logic relied on the legacy rule upgrade method, which has a known issue that causes all configured rule actions and exceptions to be lost. By removing the upgrade logic, this PR eliminates that incorrect behavior. (cherry picked from commit 9f5425f)
…cy creation (elastic#217959) **Resolves: https://github.com/elastic/security-team/issues/7216** ## Summary This PR updates the Endpoint policy callback to: - **Install only the Elastic Defend rule if it's missing**, without upgrading it to the latest version. Previously, the rule was both installed and updated whenever an Endpoint policy was created, which conflicted with rule customization. Automatic upgrades could erase existing user customizations. - **Avoid triggering the installation or upgrade of any other prebuilt rules** as part of this flow. The Endpoint package policy creation callback ([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187)) previously installed and upgraded **all** prebuilt detection rules to their target versions whenever an Endpoint policy was created. This logic relied on the legacy rule upgrade method, which has a known issue that causes all configured rule actions and exceptions to be lost. By removing the upgrade logic, this PR eliminates that incorrect behavior. (cherry picked from commit 9f5425f)
…cy creation (elastic#217959) **Resolves: https://github.com/elastic/security-team/issues/7216** ## Summary This PR updates the Endpoint policy callback to: - **Install only the Elastic Defend rule if it's missing**, without upgrading it to the latest version. Previously, the rule was both installed and updated whenever an Endpoint policy was created, which conflicted with rule customization. Automatic upgrades could erase existing user customizations. - **Avoid triggering the installation or upgrade of any other prebuilt rules** as part of this flow. The Endpoint package policy creation callback ([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187)) previously installed and upgraded **all** prebuilt detection rules to their target versions whenever an Endpoint policy was created. This logic relied on the legacy rule upgrade method, which has a known issue that causes all configured rule actions and exceptions to be lost. By removing the upgrade logic, this PR eliminates that incorrect behavior. (cherry picked from commit 9f5425f)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
…t policy creation (#217959) (#218155) # Backport This will backport the following commits from `main` to `9.0`: - [[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)](#217959) <!--- Backport version: 9.6.6 --> ### 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-14T17:22:38Z","message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","impact:high","Feature:Endpoint","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1","v8.17.5"],"title":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation","number":217959,"url":"https://github.com/elastic/kibana/pull/217959","mergeCommit":{"message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.18","9.0","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217959","number":217959,"mergeCommit":{"message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Dmitrii Shevchenko <dmitrii.shevchenko@elastic.co>
…nt policy creation (#217959) (#218153) # Backport This will backport the following commits from `main` to `8.18`: - [[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)](#217959) <!--- Backport version: 9.6.6 --> ### 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-14T17:22:38Z","message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","impact:high","Feature:Endpoint","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1","v8.17.5"],"title":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation","number":217959,"url":"https://github.com/elastic/kibana/pull/217959","mergeCommit":{"message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.18","9.0","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217959","number":217959,"mergeCommit":{"message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Dmitrii Shevchenko <dmitrii.shevchenko@elastic.co>
…t policy creation (#217959) (#218154) # Backport This will backport the following commits from `main` to `8.x`: - [[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)](#217959) <!--- Backport version: 9.6.6 --> ### 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-14T17:22:38Z","message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","impact:high","Feature:Endpoint","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1","v8.17.5"],"title":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation","number":217959,"url":"https://github.com/elastic/kibana/pull/217959","mergeCommit":{"message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.18","9.0","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217959","number":217959,"mergeCommit":{"message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Dmitrii Shevchenko <dmitrii.shevchenko@elastic.co>
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…nt policy creation (#217959) (#218209) # Backport This will backport the following commits from `main` to `8.17`: - [[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)](#217959) <!--- Backport version: 9.6.6 --> ### 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-14T17:22:38Z","message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","impact:high","Feature:Endpoint","v9.0.0","Team:Detections and Resp","Team: SecuritySolution","Team:Detection Rule Management","Feature:Prebuilt Detection Rules","backport:version","v8.18.0","v9.1.0","v8.19.0","v8.18.1","v9.0.1","v8.17.5"],"title":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation","number":217959,"url":"https://github.com/elastic/kibana/pull/217959","mergeCommit":{"message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b"}},"sourceBranch":"main","suggestedTargetBranches":["8.17"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/218155","number":218155,"state":"MERGED","mergeCommit":{"sha":"06e5e580eb3930f49dbee485c4f8dc4fadd08bb2","message":"[9.0] [Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959) (#218155)\n\n# Backport\n\nThis will backport the following commits from `main` to `9.0`:\n- [[Security Solution] Fix prebuilt rules force upgrade on Endpoint\npolicy creation\n(#217959)](https://github.com/elastic/kibana/pull/217959)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Dmitrii Shevchenko <dmitrii.shevchenko@elastic.co>"}},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/218153","number":218153,"state":"MERGED","mergeCommit":{"sha":"fc87edd906403629bb52efbdbbd20bbc7206d195","message":"[8.18] [Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959) (#218153)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.18`:\n- [[Security Solution] Fix prebuilt rules force upgrade on Endpoint\npolicy creation\n(#217959)](https://github.com/elastic/kibana/pull/217959)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Dmitrii Shevchenko <dmitrii.shevchenko@elastic.co>"}},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217959","number":217959,"mergeCommit":{"message":"[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)\n\n**Resolves: https://github.com/elastic/security-team/issues/7216**\n\n## Summary\n\nThis PR updates the Endpoint policy callback to: \n\n- **Install only the Elastic Defend rule if it's missing**, without\nupgrading it to the latest version. Previously, the rule was both\ninstalled and updated whenever an Endpoint policy was created, which\nconflicted with rule customization. Automatic upgrades could erase\nexisting user customizations.\n\n- **Avoid triggering the installation or upgrade of any other prebuilt\nrules** as part of this flow. The Endpoint package policy creation\ncallback\n([source](https://github.com/elastic/kibana/blob/f7d8bc3c25663ebd5e473087790e3a53c4901548/x-pack/solutions/security/plugins/security_solution/server/fleet_integration/fleet_integration.ts#L181-L187))\npreviously installed and upgraded **all** prebuilt detection rules to\ntheir target versions whenever an Endpoint policy was created.\n\nThis logic relied on the legacy rule upgrade method, which has a known\nissue that causes all configured rule actions and exceptions to be lost.\nBy removing the upgrade logic, this PR eliminates that incorrect\nbehavior.","sha":"9f5425f061e6fff8579f7db1117af075b1b6ca1b"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/218154","number":218154,"state":"MERGED","mergeCommit":{"sha":"48554f91e1d749d56fc1fde076a3edd0143190b3","message":"[8.x] [Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959) (#218154)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.x`:\n- [[Security Solution] Fix prebuilt rules force upgrade on Endpoint\npolicy creation\n(#217959)](https://github.com/elastic/kibana/pull/217959)\n\n\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by: Dmitrii Shevchenko <dmitrii.shevchenko@elastic.co>"}},{"branch":"8.17","label":"v8.17.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
Resolves: https://github.com/elastic/security-team/issues/7216
Summary
This PR updates the Endpoint policy callback to:
Install only the Elastic Defend rule if it's missing, without upgrading it to the latest version. Previously, the rule was both installed and updated whenever an Endpoint policy was created, which conflicted with rule customization. Automatic upgrades could erase existing user customizations.
Avoid triggering the installation or upgrade of any other prebuilt rules as part of this flow. The Endpoint package policy creation callback (source) previously installed and upgraded all prebuilt detection rules to their target versions whenever an Endpoint policy was created.
This logic relied on the legacy rule upgrade method, which has a known issue that causes all configured rule actions and exceptions to be lost. By removing the upgrade logic, this PR eliminates that incorrect behavior.