-
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][RAC] Flatten alert fields / Require Owner and Space ID fields #107581
Conversation
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
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
...ns/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts
Outdated
Show resolved
Hide resolved
...gins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts
Outdated
Show resolved
Hide resolved
...gins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts
Outdated
Show resolved
Hide resolved
...gins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts
Outdated
Show resolved
Hide resolved
...gins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts
Outdated
Show resolved
Hide resolved
export const removeClashes = (doc: SimpleHit) => { | ||
if (isWrappedSignalHit(doc)) { | ||
invariant(doc._source, '_source field not found'); | ||
const { signal, ...noSignal } = doc._source; |
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.
should we call noSignal
source
as that's where it seems to be going
...gins/security_solution/server/lib/detection_engine/rule_types/factories/utils/build_alert.ts
Outdated
Show resolved
Hide resolved
.../plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/flatten.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts
Outdated
Show resolved
Hide resolved
Pinging @elastic/apm-ui (Team:apm) |
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 for the additional changes to ensure we are creating alerts with all the required fields for RBAC.
'kibana.alert.ancestors': ancestors as object[], | ||
return ({ | ||
'@timestamp': new Date().toISOString(), | ||
[ALERT_OWNER]: 'siem', |
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.
This could be replaced with the const defined here
export const SERVER_APP_ID = 'siem'; |
@elasticmachine merge upstream |
…a into security-rule-type-flatten
}; | ||
|
||
export const isWrappedSignalHit = (event: SimpleHit): event is WrappedSignalHit => { | ||
return (event as WrappedSignalHit)._source.signal != null; |
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.
return (event as WrappedSignalHit)._source.signal != null; | |
return (event as WrappedSignalHit)?._source?.signal != null; |
}; | ||
|
||
export const isWrappedRACAlert = (event: SimpleHit): event is WrappedRACAlert => { | ||
return (event as WrappedRACAlert)._source['kibana.rac.alert.id'] != null; |
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.
return (event as WrappedRACAlert)._source['kibana.rac.alert.id'] != null; | |
return (event as WrappedRACAlert)?._source?.['kibana.rac.alert.id'] != null; |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* incremental changes * No more type errors * Type guards * Begin adding tests * Flatten * Reduce scope of branch * Remove extraneous argument to filter_duplicate_signals
* incremental changes * No more type errors * Type guards * Begin adding tests * Flatten * Reduce scope of branch * Remove extraneous argument to filter_duplicate_signals
Summary
This PR flattens the
kibana.alert.rule.*
fields in the alerts generated frombuildAlert
. This is for compatibility with theFields API
and general consistency across the RAC implementation.Additionally, tests have been added for
buildAlert
and a functiongetF
is introduced to allow us to more easily test alert values across the different implementations while the feature flag is in place forrule_registry
.Finally, we add the
kibana.alert.owner
andkibana.space_ids
fields to the alerts generated from the detection engine.Checklist
Delete any items that are not applicable to this PR.
Risk Matrix
Delete this section if it is not applicable to this PR.
Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.
When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:
For maintainers