[Security Solution] Allow users to edit required_fields field for custom rules#180682
[Security Solution] Allow users to edit required_fields field for custom rules#180682nikitaindik merged 73 commits intoelastic:mainfrom
Conversation
|
@nikitaindik Can you give an update on the progress on this PR? Is anything blocking you from completing the test coverage and opening it for review? |
f32c820 to
d47d40b
Compare
|
@banderror Sorry for the late reply. My plan is to wrap up the tests and open the PR for review today. |
d47d40b to
20c1645
Compare
|
/ci |
20c1645 to
8017f66
Compare
|
/ci |
Exploratory testingTested and working as expected:
|
| <EuiText style={{ width: POPOVER_WIDTH }} size="s"> | ||
| <FormattedMessage | ||
| id="xpack.securitySolution.detectionEngine.ruleDescription.requiredFields.fieldRequiredFieldsHelpText" | ||
| defaultMessage="Choose the fields and data types needed for this rule to function. You can select the fields available in the rule's {source} index patterns or data view." |
There was a problem hiding this comment.
@nikitaindik Here's some revised popover text, after our chat about custom fields. I also wanted to make it clearer that this is just informational — the user isn't actually configuring the rule's logic to require these fields, they're basically just documenting how the rule works.
| defaultMessage="Choose the fields and data types needed for this rule to function. You can select the fields available in the rule's {source} index patterns or data view." | |
| defaultMessage="Create an informational list of fields and data types this rule needs to function. Select fields in the rule's {source} index patterns or data view, or type in custom fields." |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Canvas Sharable Runtime
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @nikitaindik |
…rule editing pages (#217254) ## Summary Fixes #183607 Adds logic to fix the re-render performance issues caused by the related integrations component on the rule edit and creation pages. This copies a strategy used in #180682 to fix a similar issue with required fields. Related integrations component now doesn't re-render when there are updates to components that don't affect it. #### React Profile while typing in query field component  ### 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 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…rule editing pages (elastic#217254) ## Summary Fixes elastic#183607 Adds logic to fix the re-render performance issues caused by the related integrations component on the rule edit and creation pages. This copies a strategy used in elastic#180682 to fix a similar issue with required fields. Related integrations component now doesn't re-render when there are updates to components that don't affect it. #### React Profile while typing in query field component  ### 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 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 1b6376e)
…rule editing pages (elastic#217254) ## Summary Fixes elastic#183607 Adds logic to fix the re-render performance issues caused by the related integrations component on the rule edit and creation pages. This copies a strategy used in elastic#180682 to fix a similar issue with required fields. Related integrations component now doesn't re-render when there are updates to components that don't affect it. #### React Profile while typing in query field component  ### 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 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 1b6376e)
…rule editing pages (elastic#217254) ## Summary Fixes elastic#183607 Adds logic to fix the re-render performance issues caused by the related integrations component on the rule edit and creation pages. This copies a strategy used in elastic#180682 to fix a similar issue with required fields. Related integrations component now doesn't re-render when there are updates to components that don't affect it. #### React Profile while typing in query field component  ### 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 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit 1b6376e)
…ce on rule editing pages (#217254) (#218671) # Backport This will backport the following commits from `main` to `9.0`: - [[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)](#217254) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Davis Plumlee","email":"56367316+dplumlee@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-18T18:47:20Z","message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Detections and Resp","Team: SecuritySolution","Feature:Rule Management","Team:Detection Rule Management","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Security Solution] Fixes related integrations render performance on rule editing pages","number":217254,"url":"https://github.com/elastic/kibana/pull/217254","mergeCommit":{"message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217254","number":217254,"mergeCommit":{"message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
…nce on rule editing pages (#217254) (#218670) # Backport This will backport the following commits from `main` to `8.19`: - [[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)](#217254) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Davis Plumlee","email":"56367316+dplumlee@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-18T18:47:20Z","message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Detections and Resp","Team: SecuritySolution","Feature:Rule Management","Team:Detection Rule Management","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Security Solution] Fixes related integrations render performance on rule editing pages","number":217254,"url":"https://github.com/elastic/kibana/pull/217254","mergeCommit":{"message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217254","number":217254,"mergeCommit":{"message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
…nce on rule editing pages (#217254) (#218669) # Backport This will backport the following commits from `main` to `8.18`: - [[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)](#217254) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Davis Plumlee","email":"56367316+dplumlee@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-18T18:47:20Z","message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Detections and Resp","Team: SecuritySolution","Feature:Rule Management","Team:Detection Rule Management","backport:version","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Security Solution] Fixes related integrations render performance on rule editing pages","number":217254,"url":"https://github.com/elastic/kibana/pull/217254","mergeCommit":{"message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217254","number":217254,"mergeCommit":{"message":"[Security Solution] Fixes related integrations render performance on rule editing pages (#217254)\n\n## Summary\n\nFixes https://github.com/elastic/kibana/issues/183607\n\nAdds logic to fix the re-render performance issues caused by the related\nintegrations component on the rule edit and creation pages. This copies\na strategy used in #180682 to fix\na similar issue with required fields. Related integrations component now\ndoesn't re-render when there are updates to components that don't affect\nit.\n\n#### React Profile while typing in query field component\n\n\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"1b6376e9c9e09edb5b0e790bdccc7d14bd5801ca"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
…rule editing pages (elastic#217254) ## Summary Fixes elastic#183607 Adds logic to fix the re-render performance issues caused by the related integrations component on the rule edit and creation pages. This copies a strategy used in elastic#180682 to fix a similar issue with required fields. Related integrations component now doesn't re-render when there are updates to components that don't affect it. #### React Profile while typing in query field component  ### 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 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…rule editing pages (elastic#217254) ## Summary Fixes elastic#183607 Adds logic to fix the re-render performance issues caused by the related integrations component on the rule edit and creation pages. This copies a strategy used in elastic#180682 to fix a similar issue with required fields. Related integrations component now doesn't re-render when there are updates to components that don't affect it. #### React Profile while typing in query field component  ### 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 --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Resolves: #173594
Flaky test runner: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5915
Summary
This PR adds an ability to add and edit custom rule's required fields. "Required fields" is an optional field that shows the user which Elasticsearch fields are needed for the rule to run properly. The values in "required fields" don't affect rule execution in any way. It's purely documentational, similar to "setup guide" and "investigation guide". This functionality is added to both rule creation and rule editing screens. It's available for all rule types except ML.
Details
The basic flow goes like this: first you specify your index patterns (or a data view), then you can set required fields for these index patterns. Once a user adds a required field and chooses its name, he can then choose its type from the dropdown. The first available type for the field name selected automatically. User can also add their own custom names and types.
Warnings
If a field that is not present in the selected index pattern, you will see a warning message.
This can happen in the following cases:
In any of these cases, you'll see a general warning message above the form section. And then also a more specific warning message next to the field that is causing the issue.
ESQL and ML rules
Here's how available dropdown options are determined for different rule types:
For all rule types except ESQL and ML, we take the index patterns specified by the user and fetch their mappings. Then we use these fields and types to populate the dropdowns.
For ESQL rules we parse index patterns out of the query since there's no explicit index pattern form field. We then fetch the mappings for these index patterns and use them to populate the dropdowns.
For ML rules, we don't show "required fields" at all. ML rules are a special case.
Screenshots