-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[EDR Workflows] Scripts selector component in Response Console #204965
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
Changes from all commits
4d46ad6
f01f3c4
070450d
548873c
91016ea
8e9c4f0
cfb35cb
f685c41
bf735e1
67d995d
560c344
7f5ed49
425652a
e43250f
8848a10
f39c367
16eae98
f628cfe
a172281
19054ed
94bfe8a
a1ab2e0
42bfac1
3e0de66
bf0b6d7
a3804ee
8e69019
c1207f6
62bc537
4af329c
16c5591
b45c085
1d568ac
ed28820
8da516c
95fef35
58940ed
eaf8a5d
dde69e0
019cc8f
43aaa43
938d8bb
d41bb48
56c3362
5838c20
151165a
37d45e4
4110e5b
528cc50
b45cbb9
afa36a2
c480990
4454753
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,16 +25,17 @@ import type { | |
| CrowdstrikeGetAgentOnlineStatusResponse, | ||
| RelaxedCrowdstrikeBaseApiResponse, | ||
| CrowdStrikeExecuteRTRResponse, | ||
| CrowdstrikeGetScriptsResponse, | ||
| } from '../../../common/crowdstrike/types'; | ||
| import type { CrowdstrikeGetTokenResponseSchema } from '../../../common/crowdstrike/schema'; | ||
| import { CrowdstrikeGetScriptsResponseSchema } from '../../../common/crowdstrike/schema'; | ||
| import { | ||
| CrowdstrikeHostActionsParamsSchema, | ||
| CrowdstrikeGetAgentsParamsSchema, | ||
| CrowdstrikeHostActionsResponseSchema, | ||
| RelaxedCrowdstrikeBaseApiResponseSchema, | ||
| CrowdstrikeRTRCommandParamsSchema, | ||
| CrowdstrikeExecuteRTRResponseSchema, | ||
| CrowdstrikeGetScriptsParamsSchema, | ||
| CrowdstrikeApiDoNotValidateResponsesSchema, | ||
| } from '../../../common/crowdstrike/schema'; | ||
| import { SUB_ACTION } from '../../../common/crowdstrike/constants'; | ||
|
|
@@ -76,7 +77,7 @@ export class CrowdstrikeConnector extends SubActionConnector< | |
| batchExecuteRTR: string; | ||
| batchActiveResponderExecuteRTR: string; | ||
| batchAdminExecuteRTR: string; | ||
| getRTRCloudScriptsDetails: string; | ||
| getRTRCloudScripts: string; | ||
| }; | ||
|
|
||
| constructor( | ||
|
|
@@ -95,7 +96,7 @@ export class CrowdstrikeConnector extends SubActionConnector< | |
| batchExecuteRTR: `${this.config.url}/real-time-response/combined/batch-command/v1`, | ||
| batchActiveResponderExecuteRTR: `${this.config.url}/real-time-response/combined/batch-active-responder-command/v1`, | ||
| batchAdminExecuteRTR: `${this.config.url}/real-time-response/combined/batch-admin-command/v1`, | ||
| getRTRCloudScriptsDetails: `${this.config.url}/real-time-response/entities/scripts/v1`, | ||
| getRTRCloudScripts: `${this.config.url}/real-time-response/entities/scripts/v1`, | ||
| }; | ||
|
|
||
| if (!CrowdstrikeConnector.base64encodedToken) { | ||
|
|
@@ -146,11 +147,10 @@ export class CrowdstrikeConnector extends SubActionConnector< | |
| method: 'batchAdminExecuteRTR', | ||
| schema: CrowdstrikeRTRCommandParamsSchema, // Define a proper schema for the command | ||
| }); | ||
| // temporary to fetch scripts and help testing | ||
| this.registerSubAction({ | ||
| name: SUB_ACTION.GET_RTR_CLOUD_SCRIPTS, | ||
| method: 'getRTRCloudScripts', | ||
| schema: CrowdstrikeGetScriptsParamsSchema, | ||
| schema: CrowdstrikeRTRCommandParamsSchema, // Empty schema - this request do not have any parameters | ||
| }); | ||
| } | ||
| } | ||
|
|
@@ -371,18 +371,16 @@ export class CrowdstrikeConnector extends SubActionConnector< | |
| ); | ||
| } | ||
|
|
||
| // TODO: for now just for testing purposes, will be a part of a following PR | ||
| public async getRTRCloudScripts( | ||
| payload: CrowdstrikeGetAgentsParams, | ||
| payload: {}, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider removing the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided to keep it to have the same structure as other actions, especially that maybe we'll need some payload in the end when filtering data or something. Is it ok? |
||
| connectorUsageCollector: ConnectorUsageCollector | ||
| ): Promise<CrowdstrikeGetAgentOnlineStatusResponse> { | ||
| // @ts-expect-error will be a part of the next PR | ||
| return this.crowdstrikeApiRequest( | ||
| ): Promise<CrowdstrikeGetScriptsResponse> { | ||
| return await this.crowdstrikeApiRequest( | ||
| { | ||
| url: this.urls.getRTRCloudScriptsDetails, | ||
| url: this.urls.getRTRCloudScripts, | ||
| method: 'GET', | ||
| paramsSerializer, | ||
| responseSchema: RelaxedCrowdstrikeBaseApiResponseSchema, | ||
| responseSchema: CrowdstrikeGetScriptsResponseSchema, | ||
| }, | ||
| connectorUsageCollector | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * 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 { schema, type TypeOf } from '@kbn/config-schema'; | ||
| import { AgentTypeSchemaLiteral } from '..'; | ||
|
|
||
| export const CustomScriptsRequestSchema = { | ||
| query: schema.object({ | ||
| agentType: schema.maybe( | ||
| schema.oneOf( | ||
| // @ts-expect-error TS2769: No overload matches this call | ||
| AgentTypeSchemaLiteral, | ||
| { | ||
| defaultValue: 'endpoint', | ||
| } | ||
| ) | ||
| ), | ||
| }), | ||
| }; | ||
|
|
||
| export type CustomScriptsRequestQueryParams = TypeOf<typeof CustomScriptsRequestSchema.query>; |
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.
Q: Is there a reason we don't use
schema: nullwhen we register this and all above actions if the request schema is empty?Uh oh!
There was an error while loading. Please reload this page.
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.
schema:nullfor RTR is is fine 👍 Thx! The other above still need to be adjusted. I'll try to do it when there's more time to work on CrowdStrike.