-
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
Asset criticality alert enrichment #171241
Merged
nkhristinin
merged 46 commits into
elastic:main
from
oatkiller:asset-criticality-alert-enrichment
Dec 22, 2023
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
ee2fac5
Add new fields to alertsFieldMap
5f13e85
Add new fields to alerts model including BaseFieldsLatest, etc
37e1dbf
Add new alert columns to table
243c117
refactoring alert enrichment code.
8fd21de
fix makeSingleFieldMatchQuery snapshot
c692d33
restore create_single_field_match_enrichment to `main` version
887764a
remove references to should_minimum_match
0f6d337
add new extraFilter option to createSingleMatchEnrichment
29f7513
put back all the stuff abount minimum_should_match
12aa184
work in progress
e3b7020
Add alert enrichment
nkhristinin c9b2cf1
Add integrations tests
nkhristinin 2111edf
remove owners.csv
nkhristinin 219ba82
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine 070b43d
Schema changes
nkhristinin 0b77a96
fix unit tests
nkhristinin b31beb6
Add more unit tests
nkhristinin f862201
Merge branch 'main' into asset-criticality-alert-enrichment
nkhristinin 78a3694
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine c4a461e
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine c97c330
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine d3c5122
Change alert schema
nkhristinin fe33f17
change how to set field to alert
nkhristinin 10ee114
add more tests
nkhristinin c58cf48
Remove some comments
nkhristinin 498e965
fix tests
nkhristinin bd872e1
update alert schema
nkhristinin 78a5b2b
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine d7d2c6c
change alert schema
nkhristinin 4cf765e
remoe comments
nkhristinin 744aace
Fix types
nkhristinin 7b2e1ea
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine 00fdef5
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine fa8df5c
Fix path
nkhristinin 0695181
Move feature flag
nkhristinin 9ca2fa7
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine 81142da
Remove type annotation
nkhristinin 08611bf
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine 81ca783
fix tests
nkhristinin ffeb96e
PR fixes
nkhristinin 35a9be3
Clean tests
nkhristinin c296a4c
Add utility function to check if index exist
nkhristinin b44541a
Rename file
nkhristinin ed77987
Merge branch 'main' into asset-criticality-alert-enrichment
kibanamachine 84c8da9
specify test parameters
nkhristinin 5c1de12
Merge branch 'main' into asset-criticality-alert-enrichment
nkhristinin 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 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
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/security_solution/common/api/detection_engine/model/alerts/8.13.0/index.ts
This file contains 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { AlertWithCommonFields800 } from '@kbn/rule-registry-plugin/common/schemas/8.0.0'; | ||
import type { | ||
ALERT_HOST_CRITICALITY, | ||
ALERT_USER_CRITICALITY, | ||
} from '../../../../../field_maps/field_names'; | ||
import type { | ||
Ancestor8120, | ||
BaseFields8120, | ||
EqlBuildingBlockFields8120, | ||
EqlShellFields8120, | ||
NewTermsFields8120, | ||
} from '../8.12.0'; | ||
|
||
/* DO NOT MODIFY THIS SCHEMA TO ADD NEW FIELDS. These types represent the alerts that shipped in 8.13.0. | ||
Any changes to these types should be bug fixes so the types more accurately represent the alerts from 8.13.0. | ||
If you are adding new fields for a new release of Kibana, create a new sibling folder to this one | ||
for the version to be released and add the field(s) to the schema in that folder. | ||
Then, update `../index.ts` to import from the new folder that has the latest schemas, add the | ||
new schemas to the union of all alert schemas, and re-export the new schemas as the `*Latest` schemas. | ||
*/ | ||
|
||
export type { Ancestor8120 as Ancestor8130 }; | ||
|
||
export interface BaseFields8130 extends BaseFields8120 { | ||
[ALERT_HOST_CRITICALITY]: string | undefined; | ||
[ALERT_USER_CRITICALITY]: string | undefined; | ||
} | ||
|
||
export interface WrappedFields8130<T extends BaseFields8130> { | ||
_id: string; | ||
_index: string; | ||
_source: T; | ||
} | ||
|
||
export type GenericAlert8130 = AlertWithCommonFields800<BaseFields8130>; | ||
|
||
export type EqlShellFields8130 = EqlShellFields8120 & BaseFields8130; | ||
|
||
export type EqlBuildingBlockFields8130 = EqlBuildingBlockFields8120 & BaseFields8130; | ||
|
||
export type NewTermsFields8130 = NewTermsFields8120 & BaseFields8130; | ||
|
||
export type NewTermsAlert8130 = NewTermsFields8120 & BaseFields8130; | ||
|
||
export type EqlBuildingBlockAlert8130 = AlertWithCommonFields800<EqlBuildingBlockFields8120>; | ||
|
||
export type EqlShellAlert8130 = AlertWithCommonFields800<EqlShellFields8130>; | ||
|
||
export type DetectionAlert8130 = | ||
| GenericAlert8130 | ||
| EqlShellAlert8130 | ||
| EqlBuildingBlockAlert8130 | ||
| NewTermsAlert8130; |
This file contains 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
33 changes: 33 additions & 0 deletions
33
x-pack/plugins/security_solution/common/field_maps/8.13.0/alerts.ts
This file contains 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { alertsFieldMap840 } from '../8.4.0'; | ||
import { ALERT_HOST_CRITICALITY, ALERT_USER_CRITICALITY } from '../field_names'; | ||
|
||
export const alertsFieldMap8130 = { | ||
...alertsFieldMap840, | ||
/** | ||
* Stores the criticality level for the host, as determined by analysts, in relation to the alert. | ||
* The Criticality level is copied from the asset criticality index. | ||
*/ | ||
[ALERT_HOST_CRITICALITY]: { | ||
type: 'keyword', | ||
array: false, | ||
required: false, | ||
}, | ||
/** | ||
* Stores the criticality level for the user, as determined by analysts, in relation to the alert. | ||
* The Criticality level is copied from the asset criticality index. | ||
*/ | ||
[ALERT_USER_CRITICALITY]: { | ||
type: 'keyword', | ||
array: false, | ||
required: false, | ||
}, | ||
} as const; | ||
|
||
export type AlertsFieldMap8130 = typeof alertsFieldMap8130; |
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/security_solution/common/field_maps/8.13.0/index.ts
This file contains 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { AlertsFieldMap8130 } from './alerts'; | ||
import { alertsFieldMap8130 } from './alerts'; | ||
export type { AlertsFieldMap8130 }; | ||
export { alertsFieldMap8130 }; |
This file contains 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 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 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 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 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 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.
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.
@elastic/actionable-observability since these two fields are being added at the
kibana.alert.*
level, we'd like approval from you all that this will not conflict with any future fields you all plan to add.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.
@nkhristinin unless we want different fields for risk enrichment than we do for risk score docs themselves (which we hadn't up until this point), this seems like a placeholder field added in the absence of an official ECS one.
If it helps, I've just added those fields to the Risk Score Extensions RFC; in that case I think these would be
host.risk.criticality_level
anduser.risk.criticality_level
.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.
@kobelb We discussed adding severity to our rules, but we don't have a plan for it atm.
@simianhacker Do you have any input?
Just a question about the naming: How does criticality differ from severity?
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.
@kobelb We don't have any immediate plans so from a conflict perspective, I think we are good if you're good.
@maryam-saeidi I think when we (ResponseOps and Observability) work on alert severity levels, we'll probably need something similar.
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.
kibana.alert.host.criticality_level
andkibana.alert.user.criticality_level
- are used to store the Asset Criticality level which can be assigned by the user in UI for entities.Values can be
very important
,not important
,normal
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.
Thanks, @simianhacker and @maryam-saeidi. While I think the severity that we've discussed is similar to the asset criticality fields that are being added, I currently think they're two unique aspects, so I don't think we should have any conflicts here.