Fixes regression where tags are turning immutable to mutable within rules (#90326)

## Summary

Fixes regression: https://github.com/elastic/kibana/issues/90319 that has not been released where in some cases such as adding actions to a rule through an update we can and will update an immutable rule and do not expect the immutable to turn into a mutable through the tags.

Simple one-liner fix, I will update in a follow on PR with a regression test for this particular use case of actions but not with this one since we optimizing for speed of pull request to back-port.

Criticality is high and impact is high as this is data bug which can cause a lot of headaches and migrations if this goes out.

### Checklist

No unit test for this one, but a functional test will be added in a follow up
- [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
Frank Hassanabad 2021-02-04 17:06:10 -07:00 committed by GitHub
parent da9c4a89e7
commit 219a86dbe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ export const updateRules = async ({
const enabled = ruleUpdate.enabled ?? true;
const newInternalRule: InternalRuleUpdate = {
name: ruleUpdate.name,
tags: addTags(ruleUpdate.tags ?? [], existingRule.params.ruleId, false),
tags: addTags(ruleUpdate.tags ?? [], existingRule.params.ruleId, existingRule.params.immutable),
params: {
author: ruleUpdate.author ?? [],
buildingBlockType: ruleUpdate.building_block_type,