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

[8.16] [EDR Workflows] OpenApi Missing Content - Response Actions (#212510) #212871

Merged
merged 5 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
663 changes: 566 additions & 97 deletions oas_docs/output/kibana.serverless.yaml

Large diffs are not rendered by default.

662 changes: 566 additions & 96 deletions oas_docs/output/kibana.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

import { z } from '@kbn/zod';

import { SuccessResponse } from '../../model/schema/common.gen';
export type GetEndpointActionResponse = z.infer<typeof GetEndpointActionResponse>;
export const GetEndpointActionResponse = z.object({});

export type EndpointGetActionsDetailsRequestParams = z.infer<
typeof EndpointGetActionsDetailsRequestParams
Expand All @@ -29,4 +30,4 @@ export type EndpointGetActionsDetailsRequestParamsInput = z.input<
>;

export type EndpointGetActionsDetailsResponse = z.infer<typeof EndpointGetActionsDetailsResponse>;
export const EndpointGetActionsDetailsResponse = SuccessResponse;
export const EndpointGetActionsDetailsResponse = GetEndpointActionResponse;
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,46 @@ paths:
required: true
schema:
type: string
description: The ID of the action to retrieve.
example: 'fr518850-681a-4y60-aa98-e22640cae2b8'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/SuccessResponse'
$ref: '#/components/schemas/GetEndpointActionResponse'
components:
schemas:
GetEndpointActionResponse:
type: object
properties: { }
example:
data:
id: "b3d6de74-36b0-4fa8-be46-c375bf1771bf"
agents:
- "afdc366c-e2e0-4cdb-ae1d-94575bd2d8e0"
agentType: "endpoint"
command: "running-processes"
startedAt: "2022-08-08T15:24:57.402Z"
completedAt: "2022-08-08T09:50:47.672Z"
createdBy: "elastic"
isCompleted: true
wasSuccessful: true
isExpired: false
outputs:
afdc366c-e2e0-4cdb-ae1d-94575bd2d8e0:
type: "json"
content:
entries:
- pid: "822"
entity_id: "fk2ym7bl3oiu3okjcik0xosc0i0m75x3eh49nu3uaqt4dqanjt"
user: "Dexter"
command: "/opt/cmd1"
- pid: "984"
entity_id: "pwvz91m48wpj9j7ov9gtw8fp7u2rat4eu5ipte37hnhdcbi2pt"
user: "Jada"
command: "/opt/cmd3/opt/cmd3/opt/cmd3/opt/cmd3"



Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,37 @@
import { z } from '@kbn/zod';

import {
SuccessResponse,
AgentIds,
AgentTypes,
Commands,
Page,
PageSize,
Commands,
AgentIds,
UserIds,
StartDate,
EndDate,
UserIds,
Types,
AgentTypes,
WithOutputs,
Types,
} from '../../model/schema/common.gen';

export type GetEndpointActionListRouteQuery = z.infer<typeof GetEndpointActionListRouteQuery>;
export const GetEndpointActionListRouteQuery = z.object({
agentIds: AgentIds.optional(),
agentTypes: AgentTypes.optional(),
commands: Commands.optional(),
export type GetEndpointActionListResponse = z.infer<typeof GetEndpointActionListResponse>;
export const GetEndpointActionListResponse = z.object({});

export type EndpointGetActionsListRequestQuery = z.infer<typeof EndpointGetActionsListRequestQuery>;
export const EndpointGetActionsListRequestQuery = z.object({
page: Page.optional(),
/**
* Number of items per page
*/
pageSize: z.number().int().min(1).max(10000).optional().default(10),
pageSize: PageSize.optional(),
commands: Commands.optional(),
agentIds: AgentIds.optional(),
userIds: UserIds.optional(),
startDate: StartDate.optional(),
endDate: EndDate.optional(),
userIds: UserIds.optional(),
types: Types.optional(),
agentTypes: AgentTypes.optional(),
withOutputs: WithOutputs.optional(),
});

export type EndpointGetActionsListRequestQuery = z.infer<typeof EndpointGetActionsListRequestQuery>;
export const EndpointGetActionsListRequestQuery = z.object({
query: GetEndpointActionListRouteQuery,
types: Types.optional(),
});
export type EndpointGetActionsListRequestQueryInput = z.input<
typeof EndpointGetActionsListRequestQuery
>;

export type EndpointGetActionsListResponse = z.infer<typeof EndpointGetActionsListResponse>;
export const EndpointGetActionsListResponse = SuccessResponse;
export const EndpointGetActionsListResponse = GetEndpointActionListResponse;
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,121 @@ paths:
x-codegen-enabled: true
x-labels: [ess, serverless]
parameters:
- name: query
- name: page
in: query
required: true
required: false
schema:
$ref: '#/components/schemas/GetEndpointActionListRouteQuery'
$ref: '../../model/schema/common.schema.yaml#/components/schemas/Page'
- name: pageSize
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/PageSize'
- name: commands
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/Commands'
- name: agentIds
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/AgentIds'
- name: userIds
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/UserIds'
- name: startDate
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/StartDate'
- name: endDate
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/EndDate'
- name: agentTypes
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/AgentTypes'
- name: withOutputs
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/WithOutputs'
- name: types
in: query
required: false
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/Types'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/SuccessResponse'
$ref: '#/components/schemas/GetEndpointActionListResponse'
components:
schemas:
GetEndpointActionListRouteQuery:
GetEndpointActionListResponse:
type: object
properties:
agentIds:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/AgentIds'
agentTypes:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/AgentTypes'
commands:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/Commands'
page:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/Page'
pageSize:
type: integer
default: 10
minimum: 1
maximum: 10000
description: Number of items per page
startDate:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/StartDate'
endDate:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/EndDate'
userIds:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/UserIds'
types:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/Types'
withOutputs:
$ref: '../../model/schema/common.schema.yaml#/components/schemas/WithOutputs'
properties: { }
example:
page: 1
pageSize: 10
total: 4
startDate: "now-24h/h"
endDate: "now"
elasticAgentIds:
- "afdc366c-e2e0-4cdb-ae1d-94575bd2d8e0"
data:
- id: "b3d6de74-36b0-4fa8-be46-c375bf1771bf"
agents:
- "afdc366c-e2e0-4cdb-ae1d-94575bd2d8e0"
command: "running-processes"
agentType: "endpoint"
startedAt: "2022-08-08T15:24:57.402Z"
isCompleted: true
completedAt: "2022-08-08T09:50:47.672Z"
wasSuccessful: true
isExpired: false
createdBy: "elastic"
- id: "43b4098b-8752-4fbb-a7a7-6df7c74d0ee3"
agents:
- "afdc366c-e2e0-4cdb-ae1d-94575bd2d8e0"
command: "isolate"
agentType: "endpoint"
startedAt: "2022-08-08T15:23:37.359Z"
isCompleted: true
completedAt: "2022-08-08T10:41:57.352Z"
wasSuccessful: true
isExpired: false
createdBy: "elastic"
- id: "5bc92c86-b8e6-42dd-837f-12ad29e09caa"
agents:
- "afdc366c-e2e0-4cdb-ae1d-94575bd2d8e0"
command: "kill-process"
agentType: "endpoint"
startedAt: "2022-08-08T14:38:44.125Z"
isCompleted: true
completedAt: "2022-08-08T09:44:50.952Z"
wasSuccessful: true
isExpired: false
createdBy: "elastic"
comment: "bad process - taking up too much cpu"
- id: "790d54e0-3aa3-4e5b-8255-3ce9d851246a"
agents:
- "afdc366c-e2e0-4cdb-ae1d-94575bd2d8e0"
command: "unisolate"
agentType: "endpoint"
startedAt: "2022-08-08T14:38:15.391Z"
isCompleted: true
completedAt: "2022-08-08T09:40:47.398Z"
wasSuccessful: true
isExpired: false
createdBy: "elastic"
comment: "Not a threat to the network"

Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@

import { z } from '@kbn/zod';

import {
SuccessResponse,
BaseActionSchema,
Command,
Timeout,
} from '../../../model/schema/common.gen';
import { BaseActionSchema, Command, Timeout } from '../../../model/schema/common.gen';

export type ExecuteRouteRequestBody = z.infer<typeof ExecuteRouteRequestBody>;
export const ExecuteRouteRequestBody = BaseActionSchema.merge(
Expand All @@ -33,11 +28,14 @@ export const ExecuteRouteRequestBody = BaseActionSchema.merge(
})
);

export type ExecuteRouteResponse = z.infer<typeof ExecuteRouteResponse>;
export const ExecuteRouteResponse = z.object({});

export type EndpointExecuteActionRequestBody = z.infer<typeof EndpointExecuteActionRequestBody>;
export const EndpointExecuteActionRequestBody = ExecuteRouteRequestBody;
export type EndpointExecuteActionRequestBodyInput = z.input<
typeof EndpointExecuteActionRequestBody
>;

export type EndpointExecuteActionResponse = z.infer<typeof EndpointExecuteActionResponse>;
export const EndpointExecuteActionResponse = SuccessResponse;
export const EndpointExecuteActionResponse = ExecuteRouteResponse;
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ paths:
content:
application/json:
schema:
$ref: '../../../model/schema/common.schema.yaml#/components/schemas/SuccessResponse'
$ref: '#/components/schemas/ExecuteRouteResponse'

components:
schemas:
ExecuteRouteRequestBody:
example:
parameters:
command: "ls -al"
timeout: 600
endpoint_ids:
- "b3d6de74-36b0-4fa8-be46-c375bf1771bf"
comment: "Get list of all files"
allOf:
- $ref: '../../../model/schema/common.schema.yaml#/components/schemas/BaseActionSchema'
- type: object
Expand All @@ -42,3 +49,31 @@ components:
$ref: '../../../model/schema/common.schema.yaml#/components/schemas/Command'
timeout:
$ref: '../../../model/schema/common.schema.yaml#/components/schemas/Timeout'
ExecuteRouteResponse:
type: object
properties: { }
example:
data:
id: "9f934028-2300-4927-b531-b26376793dc4"
agents:
- "ed518850-681a-4d60-bb98-e22640cae2a8"
hosts:
ed518850-681a-4d60-bb98-e22640cae2a8:
name: "gke-endpoint-gke-clu-endpoint-node-po-e1a3ab89-4c4r"
agentType: "endpoint"
command: "execute"
startedAt: "2023-07-28T18:43:27.362Z"
isCompleted: false
wasSuccessful: false
isExpired: false
status: "pending"
outputs: { }
agentState:
ed518850-681a-4d60-bb98-e22640cae2a8:
isCompleted: false
wasSuccessful: false
createdBy: "myuser"
comment: "Get list of all files"
parameters:
command: "ls -al"
timeout: 600
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { z } from '@kbn/zod';

import { SuccessResponse, BaseActionSchema } from '../../../model/schema/common.gen';
import { BaseActionSchema } from '../../../model/schema/common.gen';

export type GetFileRouteRequestBody = z.infer<typeof GetFileRouteRequestBody>;
export const GetFileRouteRequestBody = BaseActionSchema.merge(
Expand All @@ -27,11 +27,14 @@ export const GetFileRouteRequestBody = BaseActionSchema.merge(
})
);

export type GetFileRouteResponse = z.infer<typeof GetFileRouteResponse>;
export const GetFileRouteResponse = z.object({});

export type EndpointGetFileActionRequestBody = z.infer<typeof EndpointGetFileActionRequestBody>;
export const EndpointGetFileActionRequestBody = GetFileRouteRequestBody;
export type EndpointGetFileActionRequestBodyInput = z.input<
typeof EndpointGetFileActionRequestBody
>;

export type EndpointGetFileActionResponse = z.infer<typeof EndpointGetFileActionResponse>;
export const EndpointGetFileActionResponse = SuccessResponse;
export const EndpointGetFileActionResponse = GetFileRouteResponse;
Loading