Skip to content
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][Alerts] Alert (+Investigation) User Assignment (#2504) #170579

Merged
merged 125 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
d508c9e
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Sep 22, 2023
23f64ed
[Security Solution][Detections] Extend alerts schema to accommodate t…
e40pud Sep 22, 2023
253423c
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 2, 2023
a815323
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 2, 2023
a008a43
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 3, 2023
abc2b7b
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 4, 2023
4eeff31
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 6, 2023
3509f78
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 6, 2023
19d081f
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 9, 2023
dc9fcff
[Security Solution][Detections] Add assignees UI into alerts table (#…
e40pud Oct 10, 2023
0f10310
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 10, 2023
8d6aa9a
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 11, 2023
389d19b
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 13, 2023
58fef4a
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 16, 2023
cc4e5ee
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 17, 2023
a338847
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 17, 2023
c3d4613
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 18, 2023
4bfc3fb
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 19, 2023
6a89c84
Fix bug where we would apply only visible selection during the search…
e40pud Oct 19, 2023
2991b8a
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 19, 2023
b9c3f9f
Fix broken tests (#169416)
e40pud Oct 19, 2023
028d19b
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 23, 2023
912af23
[Security Solution][Detections] Add assignees UI into alert's details…
e40pud Oct 23, 2023
43d191e
Locked Status and Assignee Controls for Alert Page (#7820) (#169235)
e40pud Oct 23, 2023
5d1a919
[Security Solution][Detections] UI and tests fixes of alert user assi…
e40pud Oct 23, 2023
7898231
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 24, 2023
4fc25ba
[Security Solution] Move user profiles related hooks into a separate …
e40pud Oct 25, 2023
0c637cb
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 25, 2023
006fbd4
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 26, 2023
2efac59
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 27, 2023
57f912b
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 30, 2023
8e35bf6
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 31, 2023
2746bd0
Address UI/UX feedback (#170283)
e40pud Oct 31, 2023
5f745e7
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Oct 31, 2023
99646a5
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 1, 2023
5574a72
Efficiently render user display names instead of IDs in the alerts ta…
e40pud Nov 1, 2023
664b83c
Bring current user to the top of the user profiles list (#170321)
e40pud Nov 1, 2023
6a1e419
Move user profiles into a common folder
e40pud Nov 1, 2023
9560d90
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 2, 2023
c4a29a2
Efficiently render user avatars (#170372)
e40pud Nov 3, 2023
34862d7
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 3, 2023
89ec60a
Make alerts table row to fit user profile avatars by default (#170505)
e40pud Nov 3, 2023
b6edb15
Use `useKibana` in user profiles hooks (#170523)
e40pud Nov 3, 2023
da6ce8d
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 3, 2023
7267005
Update schema version from 8.11 to 8.12 (#170576)
e40pud Nov 3, 2023
c2a2291
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 6, 2023
5d914a4
Revert "Make alerts table row to fit user profile avatars by default …
e40pud Nov 6, 2023
bad0fd9
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 6, 2023
b52d012
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 6, 2023
dd8d2b7
Merge branch 'main-upstream' into security/feature/alert-user-assignm…
e40pud Nov 6, 2023
03ee12a
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 6, 2023
de00ef0
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 7, 2023
e9d2085
Fix broken tests
e40pud Nov 7, 2023
ebe9436
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 8, 2023
f039d0d
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 8, 2023
a339a3e
Review feedback
e40pud Nov 8, 2023
9be5efc
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 8, 2023
eebe707
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 8, 2023
221723d
Fix broken test
e40pud Nov 8, 2023
935d7c9
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 8, 2023
b841c71
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 9, 2023
c6a70d3
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 9, 2023
fa16176
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 10, 2023
80b99ee
[Security Solution][Detections] Disable alert assignees updates for V…
e40pud Nov 10, 2023
f81315a
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 10, 2023
94c3bb5
Fix broken tests
e40pud Nov 10, 2023
c214e0b
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 10, 2023
6be8d31
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 13, 2023
2f0911b
[Security Solution][Detections] Assignees shown as Unknown in Timelin…
e40pud Nov 13, 2023
8ea4215
Fix broken test
e40pud Nov 13, 2023
50ea765
[Security Solution][Detections] Remove "Assignees" option in rule pre…
e40pud Nov 13, 2023
e8f74a9
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 13, 2023
cdd4fc2
Add "Remove all assignees" button for individual alert as well (#8033…
e40pud Nov 14, 2023
3aaf11d
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 14, 2023
47a9c73
[Security Solution][Detections] Sometimes alerts table and details fl…
e40pud Nov 14, 2023
fd80420
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 15, 2023
1c2c4cc
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 15, 2023
dfa3e4b
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 16, 2023
7bc6282
Fix broken tests after merge conflicts
e40pud Nov 16, 2023
04933c6
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 16, 2023
700fd6c
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 20, 2023
2ea5984
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 21, 2023
32b21e9
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 22, 2023
55eeaae
Review feedback
e40pud Nov 22, 2023
04e03fc
Remove assignees UI from the Explore page
e40pud Nov 22, 2023
38dbb5a
Wording feedback
e40pud Nov 22, 2023
28f3ad3
Fix broken tests
e40pud Nov 22, 2023
32b5aec
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 22, 2023
cb5312b
Disable "Unassign alert" on query all alerts to align with other cont…
e40pud Nov 22, 2023
f6faef4
[Security Solution][Detections] Write a test plan for Alert User Assi…
e40pud Nov 22, 2023
f6313e3
Review feedback: Better typings in `triggers_actions_ui`
e40pud Nov 22, 2023
695744b
[Security Solution][Detections] Add test coverage for Alert User Assi…
e40pud Nov 20, 2023
8a1c67a
Revert "[Security Solution][Detections] Add test coverage for Alert U…
e40pud Nov 22, 2023
23cb6a9
Hide assigning functionality in Basic license
e40pud Nov 22, 2023
31f9b86
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 22, 2023
c07b129
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 22, 2023
1735f5a
Update x-pack/plugins/triggers_actions_ui/public/application/alert_ta…
e40pud Nov 23, 2023
995ae13
Fix broken tests
e40pud Nov 23, 2023
9943139
Fix typing errors
e40pud Nov 23, 2023
3fe3bca
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 23, 2023
73aeaa0
Revert changes to Cases plugin
e40pud Nov 24, 2023
a634bba
Revert changes to Cases plugin
e40pud Nov 24, 2023
9754a02
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 24, 2023
60e092c
Fix broken tests
e40pud Nov 24, 2023
263752b
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 27, 2023
e317182
[Security Solution][Detections] Add test coverage for Alert User Assi…
e40pud Nov 27, 2023
c252c62
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 27, 2023
c2cbb99
Merge branch 'main' into security/feature/alert-user-assignment
kibanamachine Nov 27, 2023
d1adf4c
no-op commit
e40pud Nov 27, 2023
acb03f0
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 27, 2023
eb763bf
Merge branch 'main' into security/feature/alert-user-assignment
kibanamachine Nov 27, 2023
a492c78
Upselling tooltips for alert assignments feature within Basic license…
e40pud Nov 28, 2023
65f01b0
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 28, 2023
2824268
Trigger Deployment
e40pud Nov 28, 2023
58f77bb
Trigger Deployment
e40pud Nov 28, 2023
382cb59
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 29, 2023
f7a2f2d
Add `useGetCurrentUserProfile` hook description
e40pud Nov 29, 2023
5ec53d2
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 29, 2023
5f48801
Trigger Build
e40pud Nov 29, 2023
e4b4600
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 29, 2023
05aba2f
Review feedback
e40pud Nov 30, 2023
8ed3329
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 30, 2023
ddc0bfc
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Nov 30, 2023
8a6b03f
Specifying the schemas for new APIs with OpenAPI (#172285)
e40pud Dec 1, 2023
631f9b3
Merge branch 'main' into security/feature/alert-user-assignment
e40pud Dec 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
ALERT_TIME_RANGE,
ALERT_URL,
ALERT_UUID,
ALERT_WORKFLOW_ASSIGNEE_IDS,
ALERT_WORKFLOW_STATUS,
ALERT_WORKFLOW_TAGS,
SPACE_IDS,
Expand Down Expand Up @@ -190,6 +191,11 @@ export const alertFieldMap = {
array: true,
required: false,
},
[ALERT_WORKFLOW_ASSIGNEE_IDS]: {
type: 'keyword',
array: true,
required: false,
},
[EVENT_ACTION]: {
type: 'keyword',
array: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const AlertOptional = rt.partial({
'kibana.alert.start': schemaDate,
'kibana.alert.time_range': schemaDateRange,
'kibana.alert.url': schemaString,
'kibana.alert.workflow_assignee_ids': schemaStringArray,
'kibana.alert.workflow_status': schemaString,
'kibana.alert.workflow_tags': schemaStringArray,
'kibana.version': schemaString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ const SecurityAlertOptional = rt.partial({
),
'kibana.alert.time_range': schemaDateRange,
'kibana.alert.url': schemaString,
'kibana.alert.workflow_assignee_ids': schemaStringArray,
'kibana.alert.workflow_reason': schemaString,
'kibana.alert.workflow_status': schemaString,
'kibana.alert.workflow_tags': schemaStringArray,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ALERT_RISK_SCORE,
ALERT_SEVERITY,
ALERT_RULE_PARAMETERS,
ALERT_WORKFLOW_ASSIGNEE_IDS,
ALERT_WORKFLOW_TAGS,
} from '@kbn/rule-data-utils';

Expand Down Expand Up @@ -46,6 +47,7 @@ export const ALERT_EVENTS_FIELDS = [
ALERT_RULE_CONSUMER,
'@timestamp',
'kibana.alert.ancestors.index',
ALERT_WORKFLOW_ASSIGNEE_IDS,
'kibana.alert.workflow_status',
ALERT_WORKFLOW_TAGS,
'kibana.alert.group.id',
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-rule-data-utils/src/default_alerts_as_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ const ALERT_WORKFLOW_STATUS = `${ALERT_NAMESPACE}.workflow_status` as const;
// kibana.alert.workflow_tags - user workflow alert tags
const ALERT_WORKFLOW_TAGS = `${ALERT_NAMESPACE}.workflow_tags` as const;

// kibana.alert.workflow_assignee_ids - user workflow alert assignees
const ALERT_WORKFLOW_ASSIGNEE_IDS = `${ALERT_NAMESPACE}.workflow_assignee_ids` as const;

// kibana.alert.rule.category - rule type name for rule that generated this alert
const ALERT_RULE_CATEGORY = `${ALERT_RULE_NAMESPACE}.category` as const;

Expand Down Expand Up @@ -135,6 +138,7 @@ const fields = {
ALERT_TIME_RANGE,
ALERT_URL,
ALERT_UUID,
ALERT_WORKFLOW_ASSIGNEE_IDS,
ALERT_WORKFLOW_STATUS,
ALERT_WORKFLOW_TAGS,
SPACE_IDS,
Expand Down Expand Up @@ -174,6 +178,7 @@ export {
ALERT_TIME_RANGE,
ALERT_URL,
ALERT_UUID,
ALERT_WORKFLOW_ASSIGNEE_IDS,
ALERT_WORKFLOW_STATUS,
ALERT_WORKFLOW_TAGS,
SPACE_IDS,
Expand Down
2 changes: 2 additions & 0 deletions packages/kbn-rule-data-utils/src/technical_field_names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
ALERT_STATUS,
ALERT_TIME_RANGE,
ALERT_UUID,
ALERT_WORKFLOW_ASSIGNEE_IDS,
ALERT_WORKFLOW_STATUS,
ALERT_WORKFLOW_TAGS,
SPACE_IDS,
Expand Down Expand Up @@ -174,6 +175,7 @@ const fields = {
ALERT_STATUS,
ALERT_SYSTEM_STATUS,
ALERT_UUID,
ALERT_WORKFLOW_ASSIGNEE_IDS,
ALERT_WORKFLOW_REASON,
ALERT_WORKFLOW_STATUS,
ALERT_WORKFLOW_TAGS,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-securitysolution-ecs/src/signal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type SignalEcsAAD = Exclude<SignalEcs, 'rule' | 'status'> & {
building_block_type?: string[];
workflow_status?: string[];
workflow_tags?: string[];
workflow_assignee_ids?: string[];
suppression?: {
docs_count: string[];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ export const UPGRADE_INVESTIGATION_GUIDE = (requiredLicense: string) =>
requiredLicense,
},
});

export const UPGRADE_ALERT_ASSIGNMENTS = (requiredLicense: string) =>
i18n.translate('securitySolutionPackages.alertAssignments.upsell', {
defaultMessage: 'Upgrade to {requiredLicense} to make use of alert assignments',
values: {
requiredLicense,
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ export type UpsellingSectionId =
| 'osquery_automated_response_actions'
| 'ruleDetailsEndpointExceptions';

export type UpsellingMessageId = 'investigation_guide';
export type UpsellingMessageId = 'investigation_guide' | 'alert_assignments';
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ describe('mappingFromFieldMap', () => {
workflow_tags: {
type: 'keyword',
},
workflow_assignee_ids: {
type: 'keyword',
},
},
},
space_ids: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ it('matches snapshot', () => {
"required": true,
"type": "keyword",
},
"kibana.alert.workflow_assignee_ids": Object {
"array": true,
"required": false,
"type": "keyword",
},
"kibana.alert.workflow_reason": Object {
"array": false,
"required": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* 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.
*/

export * from './set_alert_assignees_route.gen';
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* 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.
*/

export * from './set_alert_assignees_route.mock';
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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 { z } from 'zod';

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*/

import { NonEmptyString } from '../model/rule_schema/common_attributes.gen';

export type AlertAssignees = z.infer<typeof AlertAssignees>;
export const AlertAssignees = z.object({
/**
* A list of users ids to assign.
*/
add: z.array(NonEmptyString),
/**
* A list of users ids to unassign.
*/
remove: z.array(NonEmptyString),
});

/**
* A list of alerts ids.
*/
export type AlertIds = z.infer<typeof AlertIds>;
export const AlertIds = z.array(NonEmptyString).min(1);

export type SetAlertAssigneesRequestBody = z.infer<typeof SetAlertAssigneesRequestBody>;
export const SetAlertAssigneesRequestBody = z.object({
/**
* Details about the assignees to assign and unassign.
*/
assignees: AlertAssignees,
/**
* List of alerts ids to assign and unassign passed assignees.
*/
ids: AlertIds,
});
export type SetAlertAssigneesRequestBodyInput = z.input<typeof SetAlertAssigneesRequestBody>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 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 { SetAlertAssigneesRequestBody } from './set_alert_assignees_route.gen';

export const getSetAlertAssigneesRequestMock = (
assigneesToAdd: string[] = [],
assigneesToRemove: string[] = [],
ids: string[] = []
): SetAlertAssigneesRequestBody => ({
assignees: { add: assigneesToAdd, remove: assigneesToRemove },
ids,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
openapi: 3.0.0
info:
title: Assign alerts API endpoint
version: '2023-10-31'
paths:
/api/detection_engine/signals/assignees:
summary: Assigns users to alerts
post:
operationId: SetAlertAssignees
x-codegen-enabled: true
description: Assigns users to alerts.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- assignees
- ids
properties:
assignees:
$ref: '#/components/schemas/AlertAssignees'
description: Details about the assignees to assign and unassign.
ids:
$ref: '#/components/schemas/AlertIds'
description: List of alerts ids to assign and unassign passed assignees.
responses:
200:
description: Indicates a successful call.
400:
description: Invalid request.

components:
schemas:
AlertAssignees:
type: object
required:
- add
- remove
properties:
add:
type: array
items:
$ref: '../model/rule_schema/common_attributes.schema.yaml#/components/schemas/NonEmptyString'
description: A list of users ids to assign.
remove:
type: array
items:
$ref: '../model/rule_schema/common_attributes.schema.yaml#/components/schemas/NonEmptyString'
description: A list of users ids to unassign.

AlertIds:
type: array
items:
$ref: '../model/rule_schema/common_attributes.schema.yaml#/components/schemas/NonEmptyString'
minItems: 1
description: A list of alerts ids.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

export * from './alert_assignees';
export * from './alert_tags';
export * from './fleet_integrations';
export * from './index_management';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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 { ALERT_WORKFLOW_ASSIGNEE_IDS } from '@kbn/rule-data-utils';
import type { AlertWithCommonFields800 } from '@kbn/rule-registry-plugin/common/schemas/8.0.0';
import type {
Ancestor890,
BaseFields890,
EqlBuildingBlockFields890,
EqlShellFields890,
NewTermsFields890,
} from '../8.9.0';

/* DO NOT MODIFY THIS SCHEMA TO ADD NEW FIELDS. These types represent the alerts that shipped in 8.12.0.
Any changes to these types should be bug fixes so the types more accurately represent the alerts from 8.12.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 { Ancestor890 as Ancestor8120 };

export interface BaseFields8120 extends BaseFields890 {
[ALERT_WORKFLOW_ASSIGNEE_IDS]: string[] | undefined;
}

export interface WrappedFields8120<T extends BaseFields8120> {
_id: string;
_index: string;
_source: T;
}

export type GenericAlert8120 = AlertWithCommonFields800<BaseFields8120>;

export type EqlShellFields8120 = EqlShellFields890 & BaseFields8120;

export type EqlBuildingBlockFields8120 = EqlBuildingBlockFields890 & BaseFields8120;

export type NewTermsFields8120 = NewTermsFields890 & BaseFields8120;

export type NewTermsAlert8120 = NewTermsFields890 & BaseFields8120;

export type EqlBuildingBlockAlert8120 = AlertWithCommonFields800<EqlBuildingBlockFields890>;

export type EqlShellAlert8120 = AlertWithCommonFields800<EqlShellFields8120>;

export type DetectionAlert8120 =
| GenericAlert8120
| EqlShellAlert8120
| EqlBuildingBlockAlert8120
| NewTermsAlert8120;
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import type { DetectionAlert840 } from './8.4.0';
import type { DetectionAlert860 } from './8.6.0';
import type { DetectionAlert870 } from './8.7.0';
import type { DetectionAlert880 } from './8.8.0';
import type { DetectionAlert890 } from './8.9.0';
import type {
Ancestor890,
BaseFields890,
DetectionAlert890,
EqlBuildingBlockFields890,
EqlShellFields890,
NewTermsFields890,
WrappedFields890,
} from './8.9.0';
Ancestor8120,
BaseFields8120,
DetectionAlert8120,
EqlBuildingBlockFields8120,
EqlShellFields8120,
NewTermsFields8120,
WrappedFields8120,
} from './8.12.0';

// When new Alert schemas are created for new Kibana versions, add the DetectionAlert type from the new version
// here, e.g. `export type DetectionAlert = DetectionAlert800 | DetectionAlert820` if a new schema is created in 8.2.0
Expand All @@ -29,14 +30,15 @@ export type DetectionAlert =
| DetectionAlert860
| DetectionAlert870
| DetectionAlert880
| DetectionAlert890;
| DetectionAlert890
| DetectionAlert8120;

export type {
Ancestor890 as AncestorLatest,
BaseFields890 as BaseFieldsLatest,
DetectionAlert890 as DetectionAlertLatest,
WrappedFields890 as WrappedFieldsLatest,
EqlBuildingBlockFields890 as EqlBuildingBlockFieldsLatest,
EqlShellFields890 as EqlShellFieldsLatest,
NewTermsFields890 as NewTermsFieldsLatest,
Ancestor8120 as AncestorLatest,
BaseFields8120 as BaseFieldsLatest,
DetectionAlert8120 as DetectionAlertLatest,
WrappedFields8120 as WrappedFieldsLatest,
EqlBuildingBlockFields8120 as EqlBuildingBlockFieldsLatest,
EqlShellFields8120 as EqlShellFieldsLatest,
NewTermsFields8120 as NewTermsFieldsLatest,
};
Loading
Loading