Skip to content

[9.0] [Security Solution] Account for missing base rule versions in is_customized calculation (#213250)#213466

Merged
banderror merged 1 commit intoelastic:9.0from
banderror:backport/9.0/pr-213250
Mar 6, 2025
Merged

[9.0] [Security Solution] Account for missing base rule versions in is_customized calculation (#213250)#213466
banderror merged 1 commit intoelastic:9.0from
banderror:backport/9.0/pr-213250

Conversation

@banderror
Copy link
Contributor

Backport

This will backport the following commits from main to 9.0:

Questions ?

Please refer to the Backport tool documentation

…omized calculation (elastic#213250)

**Partially addresses: elastic#210358

## Summary

### Editing of prebuilt rules with missing base versions

**When the base version** of a currently installed prebuilt rule **is missing** among the `security-rule` asset saved objects, and the user edits this rule:

- We should mark the rule as customized, only if the new rule settings are different from the current rule settings.
  - For example, adding a new tag should mark the rule as customized. Then, if the user removes this tag, the rule should remain to be marked as customized. This matches the current behavior.
  - However, if the user saves the rule without making any changes to it, it should keep its `is_customized` field as is. This is different from the current behavior.

### Importing of prebuilt rules with missing base versions

**When the base version** of a prebuilt rule that is being imported **is missing** among the `security-rule` asset saved objects, and the user imports this rule:

- If this rule is not installed, it should be created with `is_customized` field set to `false`.
- If this rule is already installed, it should be updated.
  - Its `is_customized` field should be set to `true` if the rule from the import payload is not equal to the installed rule.
  - Its `is_customized` field should be be kept unchanged (`false` or `true`) if the rule from the import payload is equal to the installed rule.

(cherry picked from commit 87e7cd9)
@banderror banderror requested a review from kibanamachine as a code owner March 6, 2025 19:32
@banderror banderror added the backport This PR is a backport of another PR label Mar 6, 2025
@banderror banderror enabled auto-merge (squash) March 6, 2025 19:32
@banderror banderror disabled auto-merge March 6, 2025 19:33
@banderror banderror enabled auto-merge (squash) March 6, 2025 20:27
@banderror banderror merged commit 7aef465 into elastic:9.0 Mar 6, 2025
12 checks passed
@banderror banderror deleted the backport/9.0/pr-213250 branch March 6, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants