-
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
[CTI] Filters alerts table by presence of threat (elastic/security-team#907) #96096
Conversation
...ecurity_solution/public/detections/components/alerts_table/alerts_utility_bar/index.test.tsx
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.
So, this implementation detail (using
signal.rule.threat_mapping
instead ofthreat.indicator.matched
is up for discussion.
My initial thinking was that we need a canonical definition for a threat match alert, and that "has threat match fields" was the simplest answer. To that end, I'd be happy to pair to see if we can't figure out a query that works; I'm guessing it's either the nested fields thing, or a consequence of the fields being requested.
I was also going to claim that this logic would also catch old, pre-enriched indicator alerts (which I don't think we want), however, we didn't have mappings for these fields until 7.12, so (I think) both enrichment and the ability to query threat_mapping
happened in the same release, so this should work? Regardless, I think we should try to make the former work before settling on this solution.
You've got some type failures which look related to one of my questions, so let's discuss this again on Monday :)
...ecurity_solution/public/detections/components/alerts_table/alerts_utility_bar/index.test.tsx
Show resolved
Hide resolved
...ecurity_solution/public/detections/components/alerts_table/alerts_utility_bar/index.test.tsx
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/detections/components/alerts_table/default_config.tsx
Outdated
Show resolved
Hide resolved
...k/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx
Outdated
Show resolved
Hide resolved
filter instead to achieve the same result. An old TODO has been addressed by adding an optional boolean exists to Filter type
@kibana-app-services you have been summoned because I temporarily removed a TODO that was left in the codebase, which suppressed a ts-error regarding the Filter not having an "exists" field. I briefly added an optional field to the Filter object in the data plugin, but that seemed to result in a lot of type errors in this build, so I decided to bring back the TODO -- nothing to see here. Creating a new ticket for the removal of the TODO for the future, will attach to this comment shortly. |
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.
The filter functionality works great! The only things to address are the label copy and the space between the two labels.
@@ -159,6 +167,20 @@ const AlertsUtilityBarComponent: React.FC<AlertsUtilityBarProps> = ({ | |||
label={i18n.ADDITIONAL_FILTERS_ACTIONS_SHOW_BUILDING_BLOCK} | |||
/> | |||
</BuildingBlockContainer> | |||
<ThreatMatchContainer> |
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:
<ThreatMatchContainer> | |
<ThreatMatchFilterContainer> |
export const ADDITIONAL_FILTERS_ACTIONS_SHOW_THREAT_MATCHES_ONLY = i18n.translate( | ||
'xpack.securitySolution.detectionEngine.alerts.utilityBar.additionalFiltersActions.showThreatMatchesOnly', | ||
{ | ||
defaultMessage: 'Show threat indicator matches only', |
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.
defaultMessage: 'Show threat indicator matches only', | |
defaultMessage: 'Show only threat match alerts', |
Thoughts: I would emphasize the entities that this filter is acting on (alerts), and move "only" to the beginning of the label since it's logically different than the existing building block query.
RE qualifying alert, I like "threat indicator alert" more than "threat indicator match alert" as that seems redundant, but we should probably rope product in for the final say here. /cc @MikePaquette @devonakerr
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.
I think "threat indicator match alert" is awkward, and "threat indicator alert" is more concise without losing meaning.
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.
updating as Show only threat indicator alerts
...ins/security_solution/public/detections/components/alerts_table/alerts_utility_bar/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.
I think this PR unintentionally inverted the logic of the building block filter; please do fix that before merging. Other than that, this looks great!
@@ -286,10 +288,11 @@ const RuleDetailsPageComponent = () => { | |||
|
|||
const alertDefaultFilters = useMemo( | |||
() => [ | |||
...(ruleId != null ? buildAlertsRuleIdFilter(ruleId) : []), |
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 safely remove this ternary that was here before? What was its purpose?
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.
Update: never mind, I see that you moved this logic into the function itself 👍
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.
Would be great to add a quick unit test for that 😉
onShowBuildingBlockAlertsChanged: (showBuildingBlockAlerts: boolean) => void; | ||
onShowThreatMatchesOnlyChanged: (showBuildingBlockAlerts: boolean) => void; |
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:
onShowThreatMatchesOnlyChanged: (showBuildingBlockAlerts: boolean) => void; | |
onShowThreatMatchesOnlyChanged: (showThreatMatchesOnly: boolean) => void; |
|
||
export const buildShowBuildingBlockFilter = (showBuildingBlockAlerts: boolean): Filter[] => [ |
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.
I think the logic was inverted here; we were previously returning an empty array if showBuildingBlockAlerts
was truthy.
...ins/security_solution/public/detections/components/alerts_table/alerts_utility_bar/index.tsx
Show resolved
Hide resolved
💛 Build succeeded, but was flaky
Test FailuresKibana Pipeline / general / "before all" hook for "should open a modal".Open timeline Open timeline modal "before all" hook for "should open a modal"Stack Trace
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
…am#907) (elastic#96096) [CTI] Filters alerts table by presence of threat (elastic/security-team#907)
Closes elastic/security-team#907.
Summary
This change enables alert table filtering by the presence of
signal.rule.threat_mapping
. Previously we have discussed the usage ofthreat.indicator.matched
to detect whether an alert is a "threat" or not, but I was unable to get hits onthreat
and any fields that would be under it, even though I was able to see the fields when I queried my siem-signals index with a match all query. So, this implementation detail (usingsignal.rule.threat_mapping
instead ofthreat.indicator.matched
is up for discussion.Another interesting finding was around the default filters, it appeared that the filters were reversed, in the sense that I had to use a must_not query to obtain the results containing the threats, as opposed to a must. I found this peculiar, so please let me know if there are any improvements to be made in this area.
Lastly, a few unit tests were added, but so far there are no integration tests, I wasn't able to find if the Alerts Table is currently covered with integration tests, so I would appreciate a nudge towards that direction.
Images
not applied (Detections Home)
applied (Detections Home)
also available on the Rules page
Checklist
Delete any items that are not applicable to this PR.
For maintainers