Skip to content

[8.x] [Security Solution] Account for missing base rule versions in is_customized calculation (#213250)#213462

Merged
banderror merged 1 commit intoelastic:8.xfrom
kibanamachine:backport/8.x/pr-213250
Mar 6, 2025
Merged

[8.x] [Security Solution] Account for missing base rule versions in is_customized calculation (#213250)#213462
banderror merged 1 commit intoelastic:8.xfrom
kibanamachine:backport/8.x/pr-213250

Conversation

@kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.x:

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 disabled auto-merge March 6, 2025 19:28
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

cc @xcrzx

@banderror banderror merged commit 2614912 into elastic:8.x Mar 6, 2025
11 checks passed
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.

4 participants