-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Security Solution][Alerts] Detection engine wildcard exceptions #136147
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
952151a
Implement wildcard exceptions for detection rules
marshallmain 6ada599
Fix index pattern retrieval on edit exceptions flyout
marshallmain f067d8d
Fix API integration test logic
marshallmain ab0a7c8
Fix entry_renderer linting
marshallmain fc3c6c7
Merge branch 'main' into wildcard-exceptions
kibanamachine 6f239ee
Merge branch 'main' into wildcard-exceptions
marshallmain ad08a3e
Merge branch 'main' into wildcard-exceptions
marshallmain 51f673f
Merge branch 'main' into wildcard-exceptions
marshallmain 80e2efa
Merge branch 'main' into wildcard-exceptions
marshallmain a5265df
Remove bad fix idea
marshallmain cd9ba73
Add 'does not match' operator to UI
marshallmain 1568c6d
Fix test
marshallmain a5bfb5b
Add unit tests
marshallmain 2f3365b
Merge branch 'main' into wildcard-exceptions
marshallmain ab58aec
Merge branch 'main' into wildcard-exceptions
marshallmain 078c91b
Merge branch 'main' into wildcard-exceptions
marshallmain f83bf6b
Add wildcard exceptions to list of DE exception operators
marshallmain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -132,6 +132,9 @@ describe('operator', () => { | |
| { | ||
| label: 'matches', | ||
| }, | ||
| { | ||
| label: 'does not match', | ||
| }, | ||
| ]); | ||
| }); | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -292,6 +292,7 @@ export const BuilderEntryItem: React.FC<EntryItemProps> = ({ | |
| ); | ||
| }; | ||
|
|
||
| // eslint-disable-next-line complexity | ||
| const getFieldValueComboBox = (type: OperatorTypeEnum, isFirst: boolean): JSX.Element => { | ||
| switch (type) { | ||
| case OperatorTypeEnum.MATCH: | ||
|
|
@@ -338,13 +339,16 @@ export const BuilderEntryItem: React.FC<EntryItemProps> = ({ | |
| ); | ||
| case OperatorTypeEnum.WILDCARD: | ||
| const wildcardValue = typeof entry.value === 'string' ? entry.value : undefined; | ||
| let os: OperatingSystem = OperatingSystem.WINDOWS; | ||
| if (osTypes) { | ||
| [os] = osTypes as OperatingSystem[]; | ||
| let actualWarning: React.ReactNode | string | undefined; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know you didn't introduce wildcard here, but can we add a unit test for it in the existing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done! |
||
| if (listType !== 'detection') { | ||
| let os: OperatingSystem = OperatingSystem.WINDOWS; | ||
| if (osTypes) { | ||
| [os] = osTypes as OperatingSystem[]; | ||
| } | ||
| const warning = validateFilePathInput({ os, value: wildcardValue }); | ||
| actualWarning = | ||
| warning === FILENAME_WILDCARD_WARNING ? getWildcardWarning(warning) : warning; | ||
| } | ||
| const warning = validateFilePathInput({ os, value: wildcardValue }); | ||
| const actualWarning = | ||
| warning === FILENAME_WILDCARD_WARNING ? getWildcardWarning(warning) : warning; | ||
|
|
||
| return ( | ||
| <AutocompleteFieldWildcardComponent | ||
|
|
||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we add a unit test for this like the others here -
x-pack/plugins/lists/common/exceptions/build_exceptions_filter.test.ts?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.
done!