Skip to content

Commit 5981061

Browse files
cnasikaskibanamachineazasypkinpborgonovi
authored andcommitted
[ResponseOps][Alerting] Decouple feature IDs from consumers (elastic#183756)
## Summary This PR aims to decouple the feature IDs from the `consumer` attribute of rules and alerts. Towards: elastic#187202 Fixes: elastic#181559 Fixes: elastic#182435 > [!NOTE] > Unfortunately, I could not break the PR into smaller pieces. The APIs could not work anymore with feature IDs and had to convert them to use rule type IDs. Also, I took the chance and refactored crucial parts of the authorization class that in turn affected a lot of files. Most of the changes in the files are minimal and easy to review. The crucial changes are in the authorization class and some alerting APIs. ## Architecture ### Alerting RBAC model The Kibana security uses Elasticsearch's [application privileges](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-privileges.html#security-api-put-privileges). This way Kibana can represent and store its privilege models within Elasticsearch roles. To do that, Kibana security creates actions that are granted by a specific privilege. Alerting uses its own RBAC model and is built on top of the existing Kibana security model. The Alerting RBAC uses the `rule_type_id` and `consumer` attributes to define who owns the rule and the alerts procured by the rule. To connect the `rule_type_id` and `consumer` with the Kibana security actions the Alerting RBAC registers its custom actions. They are constructed as `alerting:<rule-type-id>/<feature-id>/<alerting-entity>/<operation>`. Because to authorizate a resource an action has to be generated and because the action needs a valid feature ID the value of the `consumer` should be a valid feature ID. For example, the `alerting:siem.esqlRule/siem/rule/get` action, means that a user with a role that grants this action can get a rule of type `siem.esqlRule` with consumer `siem`. ### Problem statement At the moment the `consumer` attribute should be a valid feature ID. Though this approach worked well so far it has its limitation. Specifically: - Rule types cannot support more than one consumer. - To associate old rules with a new feature ID required a migration on the rule's SOs and the alerts documents. - The API calls are feature ID-oriented and not rule-type-oriented. - The framework has to be aware of the values of the `consumer` attribute. - Feature IDs are tightly coupled with the alerting indices leading to [bugs](elastic#179082). - Legacy consumers that are not a valid feature anymore can cause [bugs](elastic#184595). - The framework has to be aware of legacy consumers to handle edge cases. - The framework has to be aware of specific consumers to handle edge cases. ### Proposed solution This PR aims to decouple the feature IDs from consumers. It achieves that a) by changing the way solutions configure the alerting privileges when registering a feature and b) by changing the alerting actions. The schema changes as: ``` // Old formatting id: 'siem', <--- feature ID alerting:['siem.queryRule'] // New formatting id: 'siem', <--- feature ID alerting: [{ ruleTypeId: 'siem.queryRule', consumers: ['siem'] }] <-- consumer same as the feature ID in the old formatting ``` The new actions are constructed as `alerting:<rule-type-id>/<consumer>/<alerting-entity>/<operation>`. For example `alerting:rule-type-id/my-consumer/rule/get`. The new action means that a user with a role that grants this action can get a rule of type `rule-type` with consumer `my-consumer`. Changing the action strings is not considered a breaking change as long as the user's permission works as before. In our case, this is true because the consumer will be the same as before (feature ID), and the alerting security actions will be the same. For example: **Old formatting** Schema: ``` id: 'logs', <--- feature ID alerting:['.es-query'] <-- rule type ID ``` Generated action: ``` alerting:.es-query/logs/rule/get ``` **New formatting** Schema: ``` id: 'siem', <--- feature ID alerting: [{ ruleTypeId: '.es-query', consumers: ['logs'] }] <-- consumer same as the feature ID in the old formatting ``` Generated action: ``` alerting:.es-query/logs/rule/get <--- consumer is set as logs and the action is the same as before ``` In both formating the actions are the same thus breaking changes are avoided. ### Alerting authorization class The alerting plugin uses and exports the alerting authorization class (`AlertingAuthorization`). The class is responsible for handling all authorization actions related to rules and alerts. The class changed to handle the new actions as described in the above sections. A lot of methods were renamed, removed, and cleaned up, all method arguments converted to be an object, and the response signature of some methods changed. These changes affected various pieces of the code. The changes in this class are the most important in this PR especially the `_getAuthorizedRuleTypesWithAuthorizedConsumers` method which is the cornerstone of the alerting RBAC. Please review carefully. ### Instantiation of the alerting authorization class The `AlertingAuthorizationClientFactory` is used to create instances of the `AlertingAuthorization` class. The `AlertingAuthorization` class needs to perform async operations upon instantiation. Because JS, at the moment, does not support async instantiation of classes the `AlertingAuthorization` class was assigning `Promise` objects to variables that could be resolved later in other phases of the lifecycle of the class. To improve readability and make the lifecycle of the class clearer, I separated the construction of the class (initialization) from the bootstrap process. As a result, getting the `AlertingAuthorization` class or any client that depends on it (`getRulesClient` for example) is an async operation. ### Filtering A lot of routes use the authorization class to get the authorization filter (`getFindAuthorizationFilter`), a filter that, if applied, returns only the rule types and consumers the user is authorized to. The method that returns the filter was built in a way to also support filtering on top of the authorization filter thus coupling the authorized filter with router filtering. I believe these two operations should be decoupled and the filter method should return a filter that gives you all the authorized rule types. It is the responsibility of the consumer, router in our case, to apply extra filters on top of the authorization filter. For that reason, I made all the necessary changes to decouple them. ### Legacy consumers & producer A lot of rules and alerts have been created and are still being created from observability with the `alerts` consumer. When the Alerting RBAC encounters a rule or alert with `alerts` as a consumer it falls back to the `producer` of the rule type ID to construct the actions. For example if a rule with `ruleTypeId: .es-query` and `consumer: alerts` the alerting action will be constructed as `alerting:.es-query/stackAlerts/rule/get` where `stackRules` is the producer of the `.es-query` rule type. The `producer` is used to be used in alerting authorization but due to its complexity, it was deprecated and only used as a fallback for the `alerts` consumer. To avoid breaking changes all feature privileges that specify access to rule types add the `alerts` consumer when configuring their alerting privileges. By moving the `alerts` consumer to the registration of the feature we can stop relying on the `producer`. The `producer` is not used anymore in the authorization class. In the next PRs the `producer` will removed entirely. ### Routes The following changes were introduced to the alerting routes: - All related routes changed to be rule-type oriented and not feature ID oriented. - All related routes support the `ruleTypeIds` and the `consumers` parameters for filtering. In all routes, the filters are constructed as `ruleTypeIds: ['foo'] AND consumers: ['bar'] AND authorizationFilter`. Filtering by consumers is important. In o11y for example, we do not want to show ES rule types with the `stackAlerts` consumer even if the user has access to them. - The `/internal/rac/alerts/_feature_ids` route got deleted as it was not used anywhere in the codebase and it was internal. All the changes in the routes are related to internal routes and no breaking changes are introduced. ### Constants I moved the o11y and stack rule type IDs to `kbn-rule-data-utils` and exported all security solution rule type IDs from `kbn-securitysolution-rules`. I am not a fan of having a centralized place for the rule type IDs. Ideally, consumers of the framework should specify keywords like `observablility` (category or subcategory) or even `apm.*` and the framework should know which rule type IDs to pick up. I think it is out of the scope of the PR, and at the moment it seems the most straightforward way to move forward. I will try to clean up as much as possible in further iterations. If you are interested in the upcoming work follow this issue elastic#187202. ### Other notable code changes - Change all instances of feature IDs to rule type IDs. - `isSiemRuleType`: This is a temporary helper function that is needed in places where we handle edge cases related to security solution rule types. Ideally, the framework should be agnostic to the rule types or consumers. The plan is to be removed entirely in further iterations. - Rename alerting `PluginSetupContract` and `PluginStartContract` to `AlertingServerSetup` and `AlertingServerStart`. This made me touch a lot of files but I could not resist. - `filter_consumers` was mistakenly exposed to a public API. It was undocumented. - Files or functions that were not used anywhere in the codebase got deleted. - Change the returned type of the `list` method of the `RuleTypeRegistry` from `Set<RegistryRuleType>` to `Map<string, RegistryRuleType>`. - Assertion of `KueryNode` in tests changed to an assertion of KQL using `toKqlExpression`. - Removal of `useRuleAADFields` as it is not used anywhere. ## Testing > [!CAUTION] > It is very important to test all the areas of the application where rules or alerts are being used directly or indirectly. Scenarios to consider: > - The correct rules, alerts, and aggregations on top of them are being shown as expected as a superuser. > - The correct rules, alerts, and aggregations on top of them are being shown as expected by a user with limited access to certain features. > - The changes in this PR are backward compatible with the previous users' permissions. ### Solutions Please test and verify that: - All the rule types you own with all possible combinations of permissions both in ESS and in Serverless. - The consumers and rule types make sense when registering the features. - The consumers and rule types that are passed to the components are the intended ones. ### ResponseOps The most important changes are in the alerting authorization class, the search strategy, and the routes. Please test: - The rules we own with all possible combinations of permissions. - The stack alerts page and its solution filtering. - The categories filtering in the maintenance window UI. ## Risks > [!WARNING] > The risks involved in this PR are related to privileges. Specifically: > - Users with no privileges can access rules and alerts they do not have access to. > - Users with privileges cannot access rules and alerts they have access to. > > An excessive list of integration tests is in place to ensure that the above scenarios will not occur. In the case of a bug, we could a) release an energy release for serverless and b) backport the fix in ESS. Given that this PR is intended to be merged in 8.17 we have plenty of time to test and to minimize the chances of risks. ## FQA - I noticed that a lot of routes support the `filter` parameter where we can pass an arbitrary KQL filter. Why we do not use this to filter by the rule type IDs and the consumers and instead we introduce new dedicated parameters? The `filter` parameter should not be exposed in the first place. It assumes that the consumer of the API knows the underlying structure and implementation details of the persisted storage API (SavedObject client API). For example, a valid filter would be `alerting.attributes.rule_type_id`. In this filter the consumer should know a) the name of the SO b) the keyword `attributes` (storage implementation detail) and c) the name of the attribute as it is persisted in ES (snake case instead of camel case as it is returned by the APIs). As there is no abstraction layer between the SO and the API, it makes it very difficult to make changes in the persistent schema or the APIs. For all the above I decided to introduce new query parameters where the alerting framework has total control over it. - I noticed in the code a lot of instances where the consumer is used. Should not remove any logic around consumers? This PR is a step forward making the framework as agnostic as possible. I had to keep the scope of the PR as contained as possible. We will get there. It needs time :). - I noticed a lot of hacks like checking if the rule type is `siem`. Should not remove the hacks? This PR is a step forward making the framework as agnostic as possible. I had to keep the scope of the PR as contained as possible. We will get there. It needs time :). - I hate the "Role visibility" dropdown. Can we remove it? I also do not like it. The goal is to remove it. Follow elastic#189997. --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Aleh Zasypkin <[email protected]> Co-authored-by: Paula Borgonovi <[email protected]>
1 parent b6fe189 commit 5981061

File tree

530 files changed

+30016
-14403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

530 files changed

+30016
-14403
lines changed

packages/kbn-alerting-types/search_strategy_types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
import type { IEsSearchRequest, IEsSearchResponse } from '@kbn/search-types';
11-
import type { ValidFeatureId } from '@kbn/rule-data-utils';
1211
import type {
1312
MappingRuntimeFields,
1413
QueryDslFieldAndFormat,
@@ -18,7 +17,8 @@ import type {
1817
import type { Alert } from './alert_type';
1918

2019
export type RuleRegistrySearchRequest = IEsSearchRequest & {
21-
featureIds: ValidFeatureId[];
20+
ruleTypeIds: string[];
21+
consumers?: string[];
2222
fields?: QueryDslFieldAndFormat[];
2323
query?: Pick<QueryDslQueryContainer, 'bool' | 'ids'>;
2424
sort?: SortCombinations[];
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
// ---------------------------------- WARNING ----------------------------------
10+
// this file was generated, and should not be edited by hand
11+
// ---------------------------------- WARNING ----------------------------------
12+
import * as rt from 'io-ts';
13+
import { Either } from 'fp-ts/lib/Either';
14+
import { AlertSchema } from './alert_schema';
15+
import { EcsSchema } from './ecs_schema';
16+
const ISO_DATE_PATTERN = /^d{4}-d{2}-d{2}Td{2}:d{2}:d{2}.d{3}Z$/;
17+
export const IsoDateString = new rt.Type<string, string, unknown>(
18+
'IsoDateString',
19+
rt.string.is,
20+
(input, context): Either<rt.Errors, string> => {
21+
if (typeof input === 'string' && ISO_DATE_PATTERN.test(input)) {
22+
return rt.success(input);
23+
} else {
24+
return rt.failure(input, context);
25+
}
26+
},
27+
rt.identity
28+
);
29+
export type IsoDateStringC = typeof IsoDateString;
30+
export const schemaUnknown = rt.unknown;
31+
export const schemaUnknownArray = rt.array(rt.unknown);
32+
export const schemaString = rt.string;
33+
export const schemaStringArray = rt.array(schemaString);
34+
export const schemaNumber = rt.number;
35+
export const schemaNumberArray = rt.array(schemaNumber);
36+
export const schemaDate = rt.union([IsoDateString, schemaNumber]);
37+
export const schemaDateArray = rt.array(schemaDate);
38+
export const schemaDateRange = rt.partial({
39+
gte: schemaDate,
40+
lte: schemaDate,
41+
});
42+
export const schemaDateRangeArray = rt.array(schemaDateRange);
43+
export const schemaStringOrNumber = rt.union([schemaString, schemaNumber]);
44+
export const schemaStringOrNumberArray = rt.array(schemaStringOrNumber);
45+
export const schemaBoolean = rt.boolean;
46+
export const schemaBooleanArray = rt.array(schemaBoolean);
47+
const schemaGeoPointCoords = rt.type({
48+
type: schemaString,
49+
coordinates: schemaNumberArray,
50+
});
51+
const schemaGeoPointString = schemaString;
52+
const schemaGeoPointLatLon = rt.type({
53+
lat: schemaNumber,
54+
lon: schemaNumber,
55+
});
56+
const schemaGeoPointLocation = rt.type({
57+
location: schemaNumberArray,
58+
});
59+
const schemaGeoPointLocationString = rt.type({
60+
location: schemaString,
61+
});
62+
export const schemaGeoPoint = rt.union([
63+
schemaGeoPointCoords,
64+
schemaGeoPointString,
65+
schemaGeoPointLatLon,
66+
schemaGeoPointLocation,
67+
schemaGeoPointLocationString,
68+
]);
69+
export const schemaGeoPointArray = rt.array(schemaGeoPoint);
70+
// prettier-ignore
71+
const ObservabilityThresholdAlertRequired = rt.type({
72+
});
73+
// prettier-ignore
74+
const ObservabilityThresholdAlertOptional = rt.partial({
75+
'kibana.alert.context': schemaUnknown,
76+
'kibana.alert.evaluation.threshold': schemaStringOrNumber,
77+
'kibana.alert.evaluation.value': schemaStringOrNumber,
78+
'kibana.alert.evaluation.values': schemaStringOrNumberArray,
79+
'kibana.alert.group': rt.array(
80+
rt.partial({
81+
field: schemaStringArray,
82+
value: schemaStringArray,
83+
})
84+
),
85+
});
86+
87+
// prettier-ignore
88+
export const ObservabilityThresholdAlertSchema = rt.intersection([ObservabilityThresholdAlertRequired, ObservabilityThresholdAlertOptional, AlertSchema, EcsSchema]);
89+
// prettier-ignore
90+
export type ObservabilityThresholdAlert = rt.TypeOf<typeof ObservabilityThresholdAlertSchema>;

packages/kbn-alerts-grouping/src/components/alerts_grouping.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import { groupingSearchResponse } from '../mocks/grouping_query.mock';
2323
import { useAlertsGroupingState } from '../contexts/alerts_grouping_context';
2424
import { I18nProvider } from '@kbn/i18n-react';
2525
import {
26-
mockFeatureIds,
26+
mockRuleTypeIds,
27+
mockConsumers,
2728
mockDate,
2829
mockGroupingProps,
2930
mockGroupingId,
@@ -146,7 +147,8 @@ describe('AlertsGrouping', () => {
146147
expect.objectContaining({
147148
params: {
148149
aggregations: {},
149-
featureIds: mockFeatureIds,
150+
ruleTypeIds: mockRuleTypeIds,
151+
consumers: mockConsumers,
150152
groupByField: 'kibana.alert.rule.name',
151153
filters: [
152154
{

packages/kbn-alerts-grouping/src/components/alerts_grouping.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const AlertsGroupingInternal = <T extends BaseAlertsGroupAggregations>(
6666
const {
6767
groupingId,
6868
services,
69-
featureIds,
69+
ruleTypeIds,
7070
defaultGroupingOptions,
7171
defaultFilters,
7272
globalFilters,
@@ -79,7 +79,7 @@ const AlertsGroupingInternal = <T extends BaseAlertsGroupAggregations>(
7979
const { grouping, updateGrouping } = useAlertsGroupingState(groupingId);
8080

8181
const { dataView } = useAlertsDataView({
82-
featureIds,
82+
ruleTypeIds,
8383
dataViewsService: dataViews,
8484
http,
8585
toasts: notifications.toasts,
@@ -252,7 +252,7 @@ const typedMemo: <T>(c: T) => T = memo;
252252
*
253253
* return (
254254
* <AlertsGrouping<YourAggregationsType>
255-
* featureIds={[...]}
255+
* ruleTypeIds={[...]}
256256
* globalQuery={{ query: ..., language: 'kql' }}
257257
* globalFilters={...}
258258
* from={...}

packages/kbn-alerts-grouping/src/components/alerts_grouping_level.test.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ const mockGroupingLevelProps: Omit<AlertsGroupingLevelProps, 'children'> = {
5555
describe('AlertsGroupingLevel', () => {
5656
let buildEsQuerySpy: jest.SpyInstance;
5757

58+
beforeEach(() => {
59+
jest.clearAllMocks();
60+
});
61+
5862
beforeAll(() => {
5963
buildEsQuerySpy = jest.spyOn(buildEsQueryModule, 'buildEsQuery');
6064
});
@@ -119,4 +123,58 @@ describe('AlertsGroupingLevel', () => {
119123
Object.keys(groupingSearchResponse.aggregations)
120124
);
121125
});
126+
127+
it('should calls useGetAlertsGroupAggregationsQuery with correct props', () => {
128+
render(
129+
<AlertsGroupingLevel {...mockGroupingLevelProps}>
130+
{() => <span data-test-subj="grouping-level" />}
131+
</AlertsGroupingLevel>
132+
);
133+
134+
expect(mockUseGetAlertsGroupAggregationsQuery.mock.calls).toMatchInlineSnapshot(`
135+
Array [
136+
Array [
137+
Object {
138+
"enabled": true,
139+
"http": Object {
140+
"get": [MockFunction],
141+
},
142+
"params": Object {
143+
"aggregations": Object {},
144+
"consumers": Array [
145+
"stackAlerts",
146+
],
147+
"filters": Array [
148+
Object {
149+
"bool": Object {
150+
"filter": Array [],
151+
"must": Array [],
152+
"must_not": Array [],
153+
"should": Array [],
154+
},
155+
},
156+
Object {
157+
"range": Object {
158+
"kibana.alert.time_range": Object {
159+
"gte": "2020-07-07T08:20:18.966Z",
160+
"lte": "2020-07-08T08:20:18.966Z",
161+
},
162+
},
163+
},
164+
],
165+
"groupByField": "selectedGroup",
166+
"pageIndex": 0,
167+
"pageSize": 10,
168+
"ruleTypeIds": Array [
169+
".es-query",
170+
],
171+
},
172+
"toasts": Object {
173+
"addDanger": [MockFunction],
174+
},
175+
},
176+
],
177+
]
178+
`);
179+
});
122180
});

packages/kbn-alerts-grouping/src/components/alerts_grouping_level.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const DEFAULT_FILTERS: Filter[] = [];
4646
const typedMemo: <T>(c: T) => T = memo;
4747
export const AlertsGroupingLevel = typedMemo(
4848
<T extends BaseAlertsGroupAggregations>({
49-
featureIds,
49+
ruleTypeIds,
50+
consumers,
5051
defaultFilters = DEFAULT_FILTERS,
5152
from,
5253
getGrouping,
@@ -86,7 +87,8 @@ export const AlertsGroupingLevel = typedMemo(
8687

8788
const aggregationsQuery = useMemo<UseGetAlertsGroupAggregationsQueryProps['params']>(() => {
8889
return {
89-
featureIds,
90+
ruleTypeIds,
91+
consumers,
9092
groupByField: selectedGroup,
9193
aggregations: getAggregationsByGroupingField(selectedGroup)?.reduce(
9294
(acc, val) => Object.assign(acc, val),
@@ -107,12 +109,13 @@ export const AlertsGroupingLevel = typedMemo(
107109
pageSize,
108110
};
109111
}, [
110-
featureIds,
112+
consumers,
111113
filters,
112114
from,
113115
getAggregationsByGroupingField,
114116
pageIndex,
115117
pageSize,
118+
ruleTypeIds,
116119
selectedGroup,
117120
to,
118121
]);

packages/kbn-alerts-grouping/src/mocks/grouping_props.mock.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
*/
99

1010
import React from 'react';
11-
import { AlertConsumers } from '@kbn/rule-data-utils';
1211
import { AlertsGroupingProps } from '../types';
1312

1413
export const mockGroupingId = 'test';
1514

16-
export const mockFeatureIds = [AlertConsumers.STACK_ALERTS];
15+
export const mockRuleTypeIds = ['.es-query'];
16+
export const mockConsumers = ['stackAlerts'];
1717

1818
export const mockDate = {
1919
from: '2020-07-07T08:20:18.966Z',
@@ -30,7 +30,8 @@ export const mockOptions = [
3030
export const mockGroupingProps: Omit<AlertsGroupingProps, 'children'> = {
3131
...mockDate,
3232
groupingId: mockGroupingId,
33-
featureIds: mockFeatureIds,
33+
ruleTypeIds: mockRuleTypeIds,
34+
consumers: mockConsumers,
3435
defaultGroupingOptions: mockOptions,
3536
getAggregationsByGroupingField: () => [],
3637
getGroupStats: () => [{ title: 'Stat', component: <span /> }],

packages/kbn-alerts-grouping/src/mocks/grouping_query.mock.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export const getQuery = ({
1111
selectedGroup,
1212
uniqueValue,
1313
timeRange,
14-
featureIds,
14+
ruleTypeIds,
1515
}: {
1616
selectedGroup: string;
1717
uniqueValue: string;
1818
timeRange: { from: string; to: string };
19-
featureIds: string[];
19+
ruleTypeIds: string[];
2020
}) => ({
2121
_source: false,
2222
aggs: {
@@ -52,7 +52,7 @@ export const getQuery = ({
5252
},
5353
},
5454
},
55-
feature_ids: featureIds,
55+
rule_type_ids: ruleTypeIds,
5656
query: {
5757
bool: {
5858
filter: [

packages/kbn-alerts-grouping/src/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
import type { Filter, Query } from '@kbn/es-query';
11-
import { ValidFeatureId } from '@kbn/rule-data-utils';
1211
import type { NotificationsStart } from '@kbn/core-notifications-browser';
1312
import type { DataViewsServicePublic } from '@kbn/data-views-plugin/public/types';
1413
import type { HttpSetup } from '@kbn/core-http-browser';
@@ -63,9 +62,13 @@ export interface AlertsGroupingProps<
6362
*/
6463
defaultGroupingOptions: GroupOption[];
6564
/**
66-
* The alerting feature ids this grouping covers
65+
* The alerting rule type ids this grouping covers
6766
*/
68-
featureIds: ValidFeatureId[];
67+
ruleTypeIds: string[];
68+
/**
69+
* The alerting consumers this grouping covers
70+
*/
71+
consumers?: string[];
6972
/**
7073
* Time filter start
7174
*/

packages/kbn-alerts-ui-shared/src/action_variables/transforms.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,5 +289,6 @@ function getAlertType(actionVariables: ActionVariables): RuleType {
289289
producer: ALERTING_FEATURE_ID,
290290
minimumLicenseRequired: 'basic',
291291
enabledInLicense: true,
292+
category: 'my-category',
292293
};
293294
}

0 commit comments

Comments
 (0)