[9.0] [Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation (#217959)#218155
Merged
Merged
Conversation
…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)
Contributor
💚 Build Succeeded
Metrics [docs]
cc @xcrzx |
xcrzx
pushed a commit
that referenced
this pull request
Apr 15, 2025
…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-->
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
mainto9.0:Questions ?
Please refer to the Backport tool documentation