forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Endpoint][Host Isolation] Remove agent status for…
… non endpoint alerts (elastic#102976)
- Loading branch information
Showing
6 changed files
with
58 additions
and
8 deletions.
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
31 changes: 31 additions & 0 deletions
31
x-pack/plugins/security_solution/public/common/utils/endpoint_alert_check.test.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,31 @@ | ||
/* | ||
* 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 _ from 'lodash'; | ||
import { mockDetailItemData } from '../mock'; | ||
import { endpointAlertCheck } from './endpoint_alert_check'; | ||
|
||
describe('utils', () => { | ||
describe('endpointAlertCheck', () => { | ||
it('should return false if detections data does not come from endpoint rule', () => { | ||
expect(endpointAlertCheck({ data: mockDetailItemData })).toBeFalsy(); | ||
}); | ||
it('should return true if detections data comes from an endpoint rule', () => { | ||
_.remove(mockDetailItemData, function (o) { | ||
return o.field === 'agent.type'; | ||
}); | ||
const mockEndpointDetailItemData = _.concat(mockDetailItemData, { | ||
field: 'agent.type', | ||
originalValue: 'endpoint', | ||
values: ['endpoint'], | ||
isObjectArray: false, | ||
}); | ||
|
||
expect(endpointAlertCheck({ data: mockEndpointDetailItemData })).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/security_solution/public/common/utils/endpoint_alert_check.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,14 @@ | ||
/* | ||
* 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 { find } from 'lodash/fp'; | ||
import { TimelineEventsDetailsItem } from '../../../common/search_strategy'; | ||
|
||
export const endpointAlertCheck = ({ data }: { data: TimelineEventsDetailsItem[] | null }) => { | ||
const findEndpointAlert = find({ field: 'agent.type' }, data)?.values; | ||
return findEndpointAlert ? findEndpointAlert[0] === 'endpoint' : false; | ||
}; |
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