[Feature] Add support for immutable and rule_source fields in TOML export/import#5840
[Feature] Add support for immutable and rule_source fields in TOML export/import#5840aarju wants to merge 2 commits intoelastic:mainfrom
Conversation
…port/import - Introduced `immutable`, `rule_source`, `version`, and `revision` fields in the `BaseRuleData` class. - Updated `rule_prompt` to handle immutable rules correctly. - Enhanced `validates_data` method to accommodate immutable rules. - Modified `to_api_format` to include immutable fields when present. - Added unit tests to verify the functionality of immutable rule fields in TOML handling.
|
@aarju thanks for the PR! In your PR descriptions you mention:
I could not find where these exist in our pre-built rules? If they do can you provide an example? Or perhaps these are just for custom or customized rules? Main purpose for my question is whether or not there are additional conditions we need to look for in expecting these fields to be present. Thanks!
|
|
@eric-forte-elastic that field is in the ndjson when you modify a prebuilt rule. For example, I modified this rule and you can see that the data view ID now shows as modified. I also added alert suppression while I was at it. Then if you export this modified prebuilt rule it now contains the |
|
@eric-forte-elastic @Mikaayenson is anything else needed to merge this PR? |



Pull Request
Summary - What I changed
Added support for the
immutableandrule_sourcefields that exist in the prebuilt rules. These rules are used to track modifications to Elastic prebuilt rules so we should preserve them when we export and import to and from the cluster.How To Test
Checklist
bug,enhancement,schema,maintenance,Rule: New,Rule: Deprecation,Rule: Tuning,Hunt: New, orHunt: Tuningso guidelines can be generatedmeta:rapid-mergelabel if planning to merge within 24 hoursContributor checklist