[SIEM][Detection Engine] Tags being turned into null

## Summary

Test:

1.) Add a tag to a new rule
2.) Activate the rule
3.) Ensure the tag does not go away

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

~~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~~

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~

- [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
This commit is contained in:
Frank Hassanabad 2020-01-21 21:56:35 -07:00 committed by GitHub
parent 31e6a3b75a
commit b5c6c9a3e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,12 +173,11 @@ export const updateRules = async ({
} else {
// enabled is null or undefined and we do not touch the rule
}
return alertsClient.update({
id: rule.id,
data: {
tags: addTags(
tags,
tags != null ? tags : rule.tags, // Add tags as an update if it exists, otherwise re-use the older tags
rule.params.ruleId,
immutable != null ? immutable : rule.params.immutable // Add new one if it exists, otherwise re-use old one
),