-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security Solution] [Platform] Adds support for data views and runtime field mappings in rule creation, exceptions, and during execution #130929
Conversation
…le executor. Future goal is to save the data view id on the rule during rule creation / editing, then when the rule executes we query for the runtime mappings in the index-pattern SO using the data view id, then stuff those runtime mappings into the search after query and we're all good
…index-pattern SO with that data view id. update this to use SO references later.
… or the other is selected.
…l be the default displayed in the data view drop down when editing that rule, the security-solution-dataview will be the default for creating a new rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all the comments were addressed, thank you!
...plugins/security_solution/public/common/components/exceptions/add_exception_flyout/index.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks so much for all your work on this feature. Have played around with it and it's looking awesome. So many edge cases you were able to cover here.
Just left some nits around dead code left in some files.
🎉 🎉 🎉
x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/types.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/detection_engine/signals/build_events_query.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/detection_engine/rules/bulk_action_edit.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think it would be a good idea to do the data fetching and munging of the result outside of useEffects, perhaps use react query or even better in a redux middleware, but outside of that the code owners changes lgtm minus some small things already commented on 👍
💛 Build succeeded, but was flakyFailed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
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 @dhurley14 |
…r preview (#165398) ## Summary This PR addresses a bug that when a rule is created using data view, analyzer preview is blank. This is due to a check on if index exists before rendering the analyzer preview. This PR updated the index field from `kibana.alert.rule.parameter.index` to 'kibana.alert.rule.indices`, the later is introduced in #130929 and is available when a rule is created using either index patterns or data view. **How to reproduce the bug** - Refer to bug report #164829 **How to test** - Create a rule using data view - Generate some alerts - Go to alerts page, expand a row in alerts table - Go to Visualization -> Analyzer preview, the analyzer preview tree should be present ![image](https://github.com/elastic/kibana/assets/18648970/cbe0668e-335d-436a-992c-8970e75a3635) ### Checklist - [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
…r preview (elastic#165398) ## Summary This PR addresses a bug that when a rule is created using data view, analyzer preview is blank. This is due to a check on if index exists before rendering the analyzer preview. This PR updated the index field from `kibana.alert.rule.parameter.index` to 'kibana.alert.rule.indices`, the later is introduced in elastic#130929 and is available when a rule is created using either index patterns or data view. **How to reproduce the bug** - Refer to bug report elastic#164829 **How to test** - Create a rule using data view - Generate some alerts - Go to alerts page, expand a row in alerts table - Go to Visualization -> Analyzer preview, the analyzer preview tree should be present ![image](https://github.com/elastic/kibana/assets/18648970/cbe0668e-335d-436a-992c-8970e75a3635) ### Checklist - [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 (cherry picked from commit 88c04e5)
…analyzer preview (#165398) (#165508) # Backport This will backport the following commits from `main` to `8.10`: - [[Security Solution] Expandable flyout - Update index field in analyzer preview (#165398)](#165398) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"christineweng","email":"18648970+christineweng@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-09-01T17:45:26Z","message":"[Security Solution] Expandable flyout - Update index field in analyzer preview (#165398)\n\n## Summary\r\n\r\nThis PR addresses a bug that when a rule is created using data view,\r\nanalyzer preview is blank. This is due to a check on if index exists\r\nbefore rendering the analyzer preview. This PR updated the index field\r\nfrom `kibana.alert.rule.parameter.index` to 'kibana.alert.rule.indices`,\r\nthe later is introduced in https://github.com/elastic/kibana/pull/130929\r\nand is available when a rule is created using either index patterns or\r\ndata view.\r\n\r\n**How to reproduce the bug**\r\n- Refer to bug report https://github.com/elastic/kibana/issues/164829\r\n\r\n**How to test**\r\n- Create a rule using data view\r\n- Generate some alerts\r\n- Go to alerts page, expand a row in alerts table\r\n- Go to Visualization -> Analyzer preview, the analyzer preview tree\r\nshould be present\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18648970/cbe0668e-335d-436a-992c-8970e75a3635)\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"88c04e5c94f81c0c7b7ba4b965725a8878480bd9","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Threat Hunting:Investigations","v8.10.0","v8.11.0"],"number":165398,"url":"https://github.com/elastic/kibana/pull/165398","mergeCommit":{"message":"[Security Solution] Expandable flyout - Update index field in analyzer preview (#165398)\n\n## Summary\r\n\r\nThis PR addresses a bug that when a rule is created using data view,\r\nanalyzer preview is blank. This is due to a check on if index exists\r\nbefore rendering the analyzer preview. This PR updated the index field\r\nfrom `kibana.alert.rule.parameter.index` to 'kibana.alert.rule.indices`,\r\nthe later is introduced in https://github.com/elastic/kibana/pull/130929\r\nand is available when a rule is created using either index patterns or\r\ndata view.\r\n\r\n**How to reproduce the bug**\r\n- Refer to bug report https://github.com/elastic/kibana/issues/164829\r\n\r\n**How to test**\r\n- Create a rule using data view\r\n- Generate some alerts\r\n- Go to alerts page, expand a row in alerts table\r\n- Go to Visualization -> Analyzer preview, the analyzer preview tree\r\nshould be present\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18648970/cbe0668e-335d-436a-992c-8970e75a3635)\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"88c04e5c94f81c0c7b7ba4b965725a8878480bd9"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/165398","number":165398,"mergeCommit":{"message":"[Security Solution] Expandable flyout - Update index field in analyzer preview (#165398)\n\n## Summary\r\n\r\nThis PR addresses a bug that when a rule is created using data view,\r\nanalyzer preview is blank. This is due to a check on if index exists\r\nbefore rendering the analyzer preview. This PR updated the index field\r\nfrom `kibana.alert.rule.parameter.index` to 'kibana.alert.rule.indices`,\r\nthe later is introduced in https://github.com/elastic/kibana/pull/130929\r\nand is available when a rule is created using either index patterns or\r\ndata view.\r\n\r\n**How to reproduce the bug**\r\n- Refer to bug report https://github.com/elastic/kibana/issues/164829\r\n\r\n**How to test**\r\n- Create a rule using data view\r\n- Generate some alerts\r\n- Go to alerts page, expand a row in alerts table\r\n- Go to Visualization -> Analyzer preview, the analyzer preview tree\r\nshould be present\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/18648970/cbe0668e-335d-436a-992c-8970e75a3635)\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"88c04e5c94f81c0c7b7ba4b965725a8878480bd9"}}]}] BACKPORT--> Co-authored-by: christineweng <18648970+christineweng@users.noreply.github.com>
…r preview (elastic#165398) ## Summary This PR addresses a bug that when a rule is created using data view, analyzer preview is blank. This is due to a check on if index exists before rendering the analyzer preview. This PR updated the index field from `kibana.alert.rule.parameter.index` to 'kibana.alert.rule.indices`, the later is introduced in elastic#130929 and is available when a rule is created using either index patterns or data view. **How to reproduce the bug** - Refer to bug report elastic#164829 **How to test** - Create a rule using data view - Generate some alerts - Go to alerts page, expand a row in alerts table - Go to Visualization -> Analyzer preview, the analyzer preview tree should be present ![image](https://github.com/elastic/kibana/assets/18648970/cbe0668e-335d-436a-992c-8970e75a3635) ### Checklist - [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
Summary
Ref: #103587 and #97778
Overview
Users will now have the option of selecting a data view or an index pattern when creating rules. Data views will be available in the EQL, Query, Threat Indicator** , and Threshold rule types.
If a rule is configured to query a data view, any runtime field mappings defined on that data view will also be available as fields to execute during the query and for any applicable override fields such as the severity override, risk score override, rule name override, and timestamp override.
** for querying source documents only. There is not support for threat indicator data views, only index patterns for now.
Affected flows
Rule Creation
Rule creation
Rule Preview
Rule Edit
Rule Edit when error present
Rule Details
Rule details when error present
Rules Management
Apply changes to rules configured with data views
. The rule using index patterns should be updated, the rule using data views should not be.Bulk action flyout
Bulk action flyout success toast
Add rule exception modal
Example
A user has a runtime field mapping they developed on the
logs-*
data view in DiscoverAdd runtime field in Discover
And the user would now like to use that runtime field mapping as part of a query for an EQL rule (or any of the rules listed above)
Rule creation
Rule Preview
Runtime field is populated in the preview alert
Checklist
Delete any items that are not applicable to this PR.
For maintainers