Skip to content

[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation#217959

Merged
xcrzx merged 1 commit into
elastic:mainfrom
xcrzx:endpoint-integration-fix
Apr 14, 2025
Merged

[Security Solution] Fix prebuilt rules force upgrade on Endpoint policy creation#217959
xcrzx merged 1 commit into
elastic:mainfrom
xcrzx:endpoint-integration-fix

Conversation

@xcrzx
Copy link
Copy Markdown
Contributor

@xcrzx xcrzx commented Apr 11, 2025

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.

@banderror
Copy link
Copy Markdown
Contributor

@xcrzx I completed the local testing:

  • The direct bug related to the Elastic Defend integration looks to be 100% fixed:
    • The Endpoint Security rule gets installed if it's not yet installed, when user installs a new integration policy.
    • If the rule is already installed, it doesn't get updated.
    • Other rules don't get installed or updated.
  • The bug in the PUT /api/detection_engine/rules/prepackaged remains. I updated the testing results for it here. I'd suggest to fix it separately as it feel as bit lower severity.

@xcrzx xcrzx added release_note:fix Feature:Endpoint Elastic Endpoint feature Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area backport:version Backport to applied version labels v9.1.0 v8.19.0 v8.18.1 v9.0.1 v8.17.5 labels Apr 11, 2025
@xcrzx xcrzx marked this pull request as ready for review April 11, 2025 14:00
@xcrzx xcrzx requested review from a team as code owners April 11, 2025 14:00
@xcrzx xcrzx requested review from maximpn, paul-tavares and pzl April 11, 2025 14:00
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/esecurity-onboarding-and-lifecycle-mgt (Feature:Endpoint)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@xcrzx xcrzx requested a review from banderror April 11, 2025 14:47
@xcrzx xcrzx added bug Fixes for quality problems that affect the customer experience impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. labels Apr 11, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 14, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Defend Workflows Cypress Tests #6 / Automated Response Actions should have been called against a created host should have been called against a created host

Metrics [docs]

✅ unchanged

History

cc @xcrzx

@xcrzx xcrzx enabled auto-merge (squash) April 14, 2025 16:45
@xcrzx xcrzx merged commit 9f5425f into elastic:main Apr 14, 2025
9 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.17, 8.18, 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/14451777801

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 14, 2025
…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)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 14, 2025
…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)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 14, 2025
…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)
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 Some backports could not be created

Status Branch Result
8.17 Backport failed because of merge conflicts
8.18
8.x
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 217959

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Apr 14, 2025
…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>
kibanamachine added a commit that referenced this pull request Apr 14, 2025
…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>
kibanamachine added a commit that referenced this pull request Apr 14, 2025
…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>
@xcrzx
Copy link
Copy Markdown
Contributor Author

xcrzx commented Apr 15, 2025

💚 All backports created successfully

Status Branch Result
8.17

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

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-->
@xcrzx xcrzx deleted the endpoint-integration-fix branch April 15, 2025 11:39
@banderror banderror removed the v8.17.5 label Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience Feature:Endpoint Elastic Endpoint feature Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. release_note:fix Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.17.6 v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants