-
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][Detections] Fix severity and risk score overrides when field mapping exists but the mapped fields do not #87004
[Security Solution][Detections] Fix severity and risk score overrides when field mapping exists but the mapped fields do not #87004
Conversation
@MikePaquette @peluja1012 @spong As a future enhancement, do you think there's any value in letting the user type any field names in the overrides, even if the fields don't exist (yet)? So our combobox values can be used to assist users but not to restrict them, especially for cases when the user wants to create a rule before indexing any data? |
c214140
to
fbe87af
Compare
fbe87af
to
ad7a2a0
Compare
💚 Build SucceededMetrics [docs]Async chunks
Distributable file count
History
To update your PR or re-run it, just comment with: |
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.
Verified this locally; thank you for the helpful repro steps! I had a few nits but nothing to block this!
@@ -101,7 +101,11 @@ export const REFERENCE_URLS_INPUT = | |||
|
|||
export const REFRESH_BUTTON = '[data-test-subj="refreshButton"]'; | |||
|
|||
export const RISK_INPUT = '.euiRangeInput'; | |||
export const DEFAULT_RISK_SCORE_INPUT = |
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.
Is it possible to omit the .eui*
from these selectors? The data-test-subjs are much preferred, but these selectors will still be brittle to EUI changes as they are now.
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.
Yeah, I don't like this too... Unfortunately, not possible w/o submitting a PR to EUI.
<EuiRange data-test-subj="detectionEngineStepAboutRuleRiskScore-defaultRiskRange"/>
This guy renders two input
s under the hood (first one is fancy slider, second one is the normal input) and passes this data-test-subj
to both of them. So to select one of them we can use either its order or its classnames.
selectedFields: IFieldType[], | ||
fieldTypeFilter: string[] | ||
): IFieldType[] => { | ||
const map = new Map<string, IFieldType>(); |
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.
Nit: maybe this could be fieldsByName
instead of map
?
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.
Great naming suggestions, thank you! Sometimes I skip making names descriptive if the scope is small 🙂 Here I think it makes sense, I'll submit a quick PR.
existingFields.forEach((f) => map.set(f.name, f)); | ||
selectedFields.forEach((f) => map.set(f.name, f)); | ||
|
||
const array = Array.from(map.values()); |
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.
similar nit:
const array = Array.from(map.values()); | |
const uniqueFields = Array.from(map.values()); |
… when field mapping exists but the mapped fields do not (elastic#87004) * Fix Source field combobox in Severity override and Risk score override sections * Clean up * Fix unit and Cypress tests
… when field mapping exists but the mapped fields do not (elastic#87004) * Fix Source field combobox in Severity override and Risk score override sections * Clean up * Fix unit and Cypress tests
… when field mapping exists but the mapped fields do not (#87004) (#87412) * Fix Source field combobox in Severity override and Risk score override sections * Clean up * Fix unit and Cypress tests Co-authored-by: Georgii Gorbachev <[email protected]>
… when field mapping exists but the mapped fields do not (#87004) (#87411) * Fix Source field combobox in Severity override and Risk score override sections * Clean up * Fix unit and Cypress tests Co-authored-by: Georgii Gorbachev <[email protected]>
…lastic#87516) ## Summary This is a follow-up PR addressing some of the comments in: - elastic#86908 - elastic#87004
…lastic#87516) ## Summary This is a follow-up PR addressing some of the comments in: - elastic#86908 - elastic#87004
…nd marks other duplicated code (#105374) ## Summary * Removes dead duplicated code from `security_solution` and `lists` * Adds notes and TODO's where we still have duplicated logic * Adds notes where I saw that the original deviated from the copy from modifications in one file but not the other. * DOES NOT fix the bugs existing in one copy but not the other. That should be done when the copied chunks are collapsed into a package. Instead see this issue where I marked those areas: #105378 See these two files where things have deviated from our duplications as an example: [security_solution/public/common/components/autocomplete/field.tsx](https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/public/common/components/autocomplete/field.tsx ) [lists/public/exceptions/components/autocomplete/field.tsx](https://github.com/elastic/kibana/blob/master/x-pack/plugins/lists/public/exceptions/components/autocomplete/field.tsx) Ref PR where fixes are applied to one of the files but not the other (could be other PR's in addition to this one): #87004 ### Checklist Delete any items that are not applicable to this PR. - [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
…nd marks other duplicated code (elastic#105374) ## Summary * Removes dead duplicated code from `security_solution` and `lists` * Adds notes and TODO's where we still have duplicated logic * Adds notes where I saw that the original deviated from the copy from modifications in one file but not the other. * DOES NOT fix the bugs existing in one copy but not the other. That should be done when the copied chunks are collapsed into a package. Instead see this issue where I marked those areas: elastic#105378 See these two files where things have deviated from our duplications as an example: [security_solution/public/common/components/autocomplete/field.tsx](https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/public/common/components/autocomplete/field.tsx ) [lists/public/exceptions/components/autocomplete/field.tsx](https://github.com/elastic/kibana/blob/master/x-pack/plugins/lists/public/exceptions/components/autocomplete/field.tsx) Ref PR where fixes are applied to one of the files but not the other (could be other PR's in addition to this one): elastic#87004 ### Checklist Delete any items that are not applicable to this PR. - [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
…nd marks other duplicated code (#105374) (#105524) ## Summary * Removes dead duplicated code from `security_solution` and `lists` * Adds notes and TODO's where we still have duplicated logic * Adds notes where I saw that the original deviated from the copy from modifications in one file but not the other. * DOES NOT fix the bugs existing in one copy but not the other. That should be done when the copied chunks are collapsed into a package. Instead see this issue where I marked those areas: #105378 See these two files where things have deviated from our duplications as an example: [security_solution/public/common/components/autocomplete/field.tsx](https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/public/common/components/autocomplete/field.tsx ) [lists/public/exceptions/components/autocomplete/field.tsx](https://github.com/elastic/kibana/blob/master/x-pack/plugins/lists/public/exceptions/components/autocomplete/field.tsx) Ref PR where fixes are applied to one of the files but not the other (could be other PR's in addition to this one): #87004 ### Checklist Delete any items that are not applicable to this PR. - [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: Frank Hassanabad <[email protected]>
…e and moves duplicate code between lists and security_solution there (#105382) ## Summary Creates an autocomplete package from `lists` and removes duplicate code between `lists` and `security_solutions` * Consolidates different PR's where we were changing different parts of autocomplete in different ways. * Existing Cypress tests should cover any mistakes hopefully Manual Testing: * Ensure this bug does not crop up again #87004 * Make sure that the exception list autocomplete looks alright ### 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
…e and moves duplicate code between lists and security_solution there (elastic#105382) ## Summary Creates an autocomplete package from `lists` and removes duplicate code between `lists` and `security_solutions` * Consolidates different PR's where we were changing different parts of autocomplete in different ways. * Existing Cypress tests should cover any mistakes hopefully Manual Testing: * Ensure this bug does not crop up again elastic#87004 * Make sure that the exception list autocomplete looks alright ### 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
…e and moves duplicate code between lists and security_solution there (elastic#105382) ## Summary Creates an autocomplete package from `lists` and removes duplicate code between `lists` and `security_solutions` * Consolidates different PR's where we were changing different parts of autocomplete in different ways. * Existing Cypress tests should cover any mistakes hopefully Manual Testing: * Ensure this bug does not crop up again elastic#87004 * Make sure that the exception list autocomplete looks alright ### 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 # Conflicts: # x-pack/plugins/translations/translations/ja-JP.json
…e and moves duplicate code between lists and security_solution there (#105382) (#106612) ## Summary Creates an autocomplete package from `lists` and removes duplicate code between `lists` and `security_solutions` * Consolidates different PR's where we were changing different parts of autocomplete in different ways. * Existing Cypress tests should cover any mistakes hopefully Manual Testing: * Ensure this bug does not crop up again #87004 * Make sure that the exception list autocomplete looks alright ### 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 # Conflicts: # x-pack/plugins/translations/translations/ja-JP.json
Addresses: #85951 and a similar bug in Risk score override section.
Summary
Check the bug description and steps to reproduce.
When a field does not exist, but specified in severity or risk score override of an existing rule, and the user opens this rule for editing, we should show all the mapped fields, even if they don't exist. Maybe the rule has been activated (e.g. a built-in rule) but the data hasn't been indexed yet. Or maybe the data existed before, but was deleted for any reason.
The components we use to display the mapping contained strict logic for making sure that any value we display in a combobox must correspond to a real field or field value, existing right now in the indices specified in the rule. In order to be able to fix the bug, I removed this logic for "initial state" (first render), but left for the case when the user starts typing something in the combobox. In other words:
This should fix the filed bug.
Screen recording
Video
Checklist
[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)[ ] This renders correctly on smaller devices using a responsive layout. (You can test this in your browser)[ ] This was checked for cross-browser compatibilityFor maintainers