forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Fixes incorrect
from
field transform logic in `…
…upgrade/_perform` route (elastic#202824) **Fixes: elastic#202575 **Fixes: elastic#201631 **Partially addresses: elastic#202715 ## Summary All bugs have the same source > [!NOTE] > This bug/related fix is only visible with the `prebuiltRulesCustomizationEnabled` feature flag turned on. Fixes an issue where unedited prebuilt rules were being marked as "Modified" when upgraded due to a bug in the `upgrade/_perform` endpoint where the `from` field was incorrectly calculated via the `lookback` field. Solves multiple bugs where prebuilt rules were marked as "Modified" incorrectly when they were upgraded See reproduce steps in related tickets ([example](elastic#202575 (comment))) ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [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
- Loading branch information
1 parent
2bb10e9
commit 00701d5
Showing
5 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...tion_engine/prebuilt_rules/api/perform_rule_upgrade/diffable_rule_fields_mappings.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { transformDiffableFieldValues } from './diffable_rule_fields_mappings'; | ||
|
||
describe('transformDiffableFieldValues', () => { | ||
it('transforms rule_schedule into "from" value', () => { | ||
const result = transformDiffableFieldValues('from', { interval: '5m', lookback: '4m' }); | ||
expect(result).toEqual({ type: 'TRANSFORMED_FIELD', value: 'now-540s' }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters