[Security Solutions][Endpoint] Running-processes rename and refactor to processes (#135569)

* Refactor changing runnin-processes by processes command. Also handle api errors when creating the command request

* Fixes ts types

* Fix multilang key

* Use import type for type imports

* Destructure object

* Update multilang keys

* Updates const name

* Fix const names

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
David Sánchez 2022-07-05 12:59:08 +02:00 committed by GitHub
parent 1b3c4e4742
commit f94d5ff26b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 151 additions and 104 deletions

View file

@ -59,7 +59,7 @@ const BASE_ENDPOINT_ACTION_ROUTE = `${BASE_ENDPOINT_ROUTE}/action`;
/** Action Response Routes */
export const ISOLATE_HOST_ROUTE_V2 = `${BASE_ENDPOINT_ACTION_ROUTE}/isolate`;
export const UNISOLATE_HOST_ROUTE_V2 = `${BASE_ENDPOINT_ACTION_ROUTE}/unisolate`;
export const GET_RUNNING_PROCESSES_ROUTE = `${BASE_ENDPOINT_ACTION_ROUTE}/running_procs`;
export const GET_PROCESSES_ROUTE = `${BASE_ENDPOINT_ACTION_ROUTE}/running_procs`;
export const KILL_PROCESS_ROUTE = `${BASE_ENDPOINT_ACTION_ROUTE}/kill_process`;
export const SUSPEND_PROCESS_ROUTE = `${BASE_ENDPOINT_ACTION_ROUTE}/suspend_process`;

View file

@ -10,17 +10,16 @@ import { merge } from 'lodash';
import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { ENDPOINT_ACTION_RESPONSES_DS, ENDPOINT_ACTIONS_DS } from '../constants';
import { BaseDataGenerator } from './base_data_generator';
import {
import type {
ActionDetails,
ActivityLogItemTypes,
EndpointActivityLogAction,
EndpointActivityLogActionResponse,
EndpointPendingActions,
LogsEndpointAction,
LogsEndpointActionResponse,
RESPONSE_ACTION_COMMANDS,
RunningProcessesEntry,
ProcessesEntry,
} from '../types';
import { ActivityLogItemTypes, RESPONSE_ACTION_COMMANDS } from '../types';
export class EndpointActionGenerator extends BaseDataGenerator {
/** Generate a random endpoint Action request (isolate or unisolate) */
@ -188,12 +187,12 @@ export class EndpointActionGenerator extends BaseDataGenerator {
return super.randomN(max);
}
randomResponseActionRunningProcesses(n?: number): RunningProcessesEntry[] {
randomResponseActionProcesses(n?: number): ProcessesEntry[] {
const numberOfEntries = n ?? this.randomChoice([20, 30, 40, 50]);
const entries = [];
for (let i = 0; i < numberOfEntries; i++) {
entries.push({
command: this.randomResponseActionRunningProcessesCommand(),
command: this.randomResponseActionProcessesCommand(),
pid: this.randomN(1000).toString(),
entity_id: this.randomString(50),
user: this.randomUser(),
@ -203,7 +202,7 @@ export class EndpointActionGenerator extends BaseDataGenerator {
return entries;
}
protected randomResponseActionRunningProcessesCommand() {
protected randomResponseActionProcessesCommand() {
const commands = [
'/opt/cmd1',
'/opt/cmd2',

View file

@ -22,7 +22,7 @@ export interface ActionResponseOutput<TOutputContent extends object = object> {
};
}
export interface RunningProcessesEntry {
export interface ProcessesEntry {
command: string;
pid: string;
entity_id: string;
@ -221,7 +221,7 @@ export interface HostIsolationResponse {
action: string;
}
export type RunningProcessesRequestBody = TypeOf<typeof NoParametersRequestSchema.body>;
export type ProcessesRequestBody = TypeOf<typeof NoParametersRequestSchema.body>;
export interface ResponseActionApiResponse<TOutput extends object = object> {
action?: string;
data: ActionDetails<TOutput>;

View file

@ -10,7 +10,7 @@ import { CommandDefinition } from '../console';
import { IsolateActionResult } from './isolate_action';
import { ReleaseActionResult } from './release_action';
import { EndpointStatusActionResult } from './status_action';
import { GetRunningProcessesActionResult } from './get_running_processes_action';
import { GetProcessesActionResult } from './get_processes_action';
export const getEndpointResponseActionsConsoleCommands = (
endpointAgentId: string
@ -67,14 +67,11 @@ export const getEndpointResponseActionsConsoleCommands = (
},
},
{
name: 'running-processes',
about: i18n.translate(
'xpack.securitySolution.endpointConsoleCommands.runninProcesses.about',
{
defaultMessage: 'Display the running processes on the endpoint',
}
),
RenderComponent: GetRunningProcessesActionResult,
name: 'processes',
about: i18n.translate('xpack.securitySolution.endpointConsoleCommands.processes.about', {
defaultMessage: 'Display the processes on the endpoint',
}),
RenderComponent: GetProcessesActionResult,
meta: {
endpointId: endpointAgentId,
},
@ -83,7 +80,7 @@ export const getEndpointResponseActionsConsoleCommands = (
required: false,
allowMultiples: false,
about: i18n.translate(
'xpack.securitySolution.endpointConsoleCommands.isolate.arg.comment',
'xpack.securitySolution.endpointConsoleCommands.processes.arg.comment',
{ defaultMessage: 'A comment to go along with the action' }
),
},

View file

@ -16,7 +16,7 @@ import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mock
import { enterConsoleCommand } from '../console/mocks';
import { waitFor } from '@testing-library/react';
describe('When using running-processes action from response actions console', () => {
describe('When using processes action from response actions console', () => {
let render: () => Promise<ReturnType<AppContextTestRender['render']>>;
let renderResult: ReturnType<AppContextTestRender['render']>;
let apiMocks: ReturnType<typeof responseActionsHttpMocks>;
@ -54,19 +54,19 @@ describe('When using running-processes action from response actions console', ()
it('should call `running-procs` api when command is entered', async () => {
await render();
enterConsoleCommand(renderResult, 'running-processes');
enterConsoleCommand(renderResult, 'processes');
await waitFor(() => {
expect(apiMocks.responseProvider.runningProcesses).toHaveBeenCalledTimes(1);
expect(apiMocks.responseProvider.processes).toHaveBeenCalledTimes(1);
});
});
it('should accept an optional `--comment`', async () => {
await render();
enterConsoleCommand(renderResult, 'running-processes --comment "This is a comment"');
enterConsoleCommand(renderResult, 'processes --comment "This is a comment"');
await waitFor(() => {
expect(apiMocks.responseProvider.runningProcesses).toHaveBeenCalledWith(
expect(apiMocks.responseProvider.processes).toHaveBeenCalledWith(
expect.objectContaining({
body: expect.stringContaining('This is a comment'),
})
@ -76,32 +76,32 @@ describe('When using running-processes action from response actions console', ()
it('should only accept one `--comment`', async () => {
await render();
enterConsoleCommand(renderResult, 'running-processes --comment "one" --comment "two"');
enterConsoleCommand(renderResult, 'processes --comment "one" --comment "two"');
expect(renderResult.getByTestId('test-badArgument-message').textContent).toEqual(
'Argument can only be used once: --comment'
);
});
it('should call the action status api after creating the `running-processes` request', async () => {
it('should call the action status api after creating the `processes` request', async () => {
await render();
enterConsoleCommand(renderResult, 'running-processes');
enterConsoleCommand(renderResult, 'processes');
await waitFor(() => {
expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalled();
});
});
it('should show success when `running-processes` action completes with no errors', async () => {
it('should show success when `processes` action completes with no errors', async () => {
await render();
enterConsoleCommand(renderResult, 'running-processes');
enterConsoleCommand(renderResult, 'processes');
await waitFor(() => {
expect(renderResult.getByTestId('getRunningProcessesSuccessCallout')).toBeTruthy();
expect(renderResult.getByTestId('getProcessesSuccessCallout')).toBeTruthy();
});
});
it('should show error if get running-processes failed to complete successfully', async () => {
it('should show error if get processes failed to complete successfully', async () => {
const pendingDetailResponse = apiMocks.responseProvider.actionDetails({
path: '/api/endpoint/action/1.2.3',
});
@ -109,25 +109,41 @@ describe('When using running-processes action from response actions console', ()
pendingDetailResponse.data.errors = ['error one', 'error two'];
apiMocks.responseProvider.actionDetails.mockReturnValue(pendingDetailResponse);
await render();
enterConsoleCommand(renderResult, 'running-processes');
enterConsoleCommand(renderResult, 'processes');
await waitFor(() => {
expect(renderResult.getByTestId('getRunningProcessesErrorCallout').textContent).toMatch(
expect(renderResult.getByTestId('getProcessesErrorCallout').textContent).toMatch(
/error one \| error two/
);
});
});
it('should show error if get processes request failed', async () => {
// FIXME: have to identify this type error
apiMocks.responseProvider.processes.mockRejectedValueOnce({
status: 500,
message: 'this is an error',
} as never);
await render();
enterConsoleCommand(renderResult, 'processes');
await waitFor(() => {
expect(renderResult.getByTestId('performGetProcessesErrorCallout').textContent).toMatch(
/this is an error/
);
});
});
describe('and when console is closed (not terminated) and then reopened', () => {
beforeEach(() => {
const _render = render;
render = async () => {
const response = await _render();
enterConsoleCommand(response, 'running-processes');
enterConsoleCommand(response, 'processes');
await waitFor(() => {
expect(apiMocks.responseProvider.runningProcesses).toHaveBeenCalledTimes(1);
expect(apiMocks.responseProvider.processes).toHaveBeenCalledTimes(1);
});
// Hide the console
@ -137,11 +153,11 @@ describe('When using running-processes action from response actions console', ()
};
});
it('should NOT send the `running-processes` request again', async () => {
it('should NOT send the `processes` request again', async () => {
await render();
await consoleManagerMockAccess.openRunningConsole();
expect(apiMocks.responseProvider.runningProcesses).toHaveBeenCalledTimes(1);
expect(apiMocks.responseProvider.processes).toHaveBeenCalledTimes(1);
});
it('should continue to check action status when still pending', async () => {

View file

@ -9,12 +9,13 @@ import React, { memo, useEffect, useMemo } from 'react';
import styled from 'styled-components';
import { EuiBasicTable } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { HttpFetchError } from '@kbn/core/public';
import { FormattedMessage } from '@kbn/i18n-react';
import { ActionDetails, RunningProcessesEntry } from '../../../../common/endpoint/types';
import { ActionDetails, ProcessesEntry } from '../../../../common/endpoint/types';
import { useGetActionDetails } from '../../hooks/endpoint/use_get_action_details';
import { EndpointCommandDefinitionMeta } from './types';
import { CommandExecutionComponentProps } from '../console/types';
import { useSendGetEndpointRunningProcessesRequest } from '../../hooks/endpoint/use_send_get_endpoint_running_processes_request';
import { useSendGetEndpointProcessesRequest } from '../../hooks/endpoint/use_send_get_endpoint_processes_request';
// @ts-expect-error TS2769
const StyledEuiBasicTable = styled(EuiBasicTable)`
@ -38,34 +39,41 @@ const StyledEuiBasicTable = styled(EuiBasicTable)`
}
`;
export const GetRunningProcessesActionResult = memo<
export const GetProcessesActionResult = memo<
CommandExecutionComponentProps<
{ comment?: string },
{
actionId?: string;
actionRequestSent?: boolean;
completedActionDetails?: ActionDetails<RunningProcessesEntry>;
completedActionDetails?: ActionDetails<ProcessesEntry>;
apiError?: HttpFetchError;
},
EndpointCommandDefinitionMeta
>
>(({ command, setStore, store, status, setStatus, ResultComponent }) => {
const endpointId = command.commandDefinition?.meta?.endpointId;
const { actionId, completedActionDetails } = store;
const { actionId, completedActionDetails, apiError } = store;
const isPending = status === 'pending';
const isError = status === 'error';
const actionRequestSent = Boolean(store.actionRequestSent);
const getRunningProcessesApi = useSendGetEndpointRunningProcessesRequest();
const {
mutate: getProcesses,
data: getProcessesData,
isSuccess: isGetProcessesSuccess,
error: getProcessesError,
} = useSendGetEndpointProcessesRequest();
const { data: actionDetails } = useGetActionDetails<RunningProcessesEntry>(actionId ?? '-', {
const { data: actionDetails } = useGetActionDetails<ProcessesEntry>(actionId ?? '-', {
enabled: Boolean(actionId) && isPending,
refetchInterval: isPending ? 3000 : false,
});
// Send get running processes request if not yet done
// Send get processes request if not yet done
useEffect(() => {
if (!actionRequestSent && endpointId) {
getRunningProcessesApi.mutate({
getProcesses({
endpoint_ids: [endpointId],
comment: command.args.args?.comment?.[0],
});
@ -74,16 +82,28 @@ export const GetRunningProcessesActionResult = memo<
return { ...prevState, actionRequestSent: true };
});
}
}, [actionRequestSent, command.args.args?.comment, endpointId, getRunningProcessesApi, setStore]);
}, [actionRequestSent, command.args.args?.comment, endpointId, getProcesses, setStore]);
// If get running processes request was created, store the action id if necessary
// If get processes request was created, store the action id if necessary
useEffect(() => {
if (getRunningProcessesApi.isSuccess && actionId !== getRunningProcessesApi.data.data.id) {
if (isGetProcessesSuccess && actionId !== getProcessesData?.data.id) {
setStore((prevState) => {
return { ...prevState, actionId: getRunningProcessesApi.data.data.id };
return { ...prevState, actionId: getProcessesData?.data.id };
});
} else if (getProcessesError) {
setStatus('error');
setStore((prevState) => {
return { ...prevState, apiError: getProcessesError };
});
}
}, [actionId, getRunningProcessesApi.data?.data.id, getRunningProcessesApi.isSuccess, setStore]);
}, [
actionId,
getProcessesData?.data.id,
getProcessesError,
isGetProcessesSuccess,
setStatus,
setStore,
]);
useEffect(() => {
if (actionDetails?.data.isCompleted) {
@ -102,7 +122,7 @@ export const GetRunningProcessesActionResult = memo<
{
field: 'user',
name: i18n.translate(
'xpack.securitySolution.endpointResponseActions.getRunningProcesses.table.header.user',
'xpack.securitySolution.endpointResponseActions.getProcesses.table.header.user',
{ defaultMessage: 'USER' }
),
width: '10%',
@ -110,7 +130,7 @@ export const GetRunningProcessesActionResult = memo<
{
field: 'pid',
name: i18n.translate(
'xpack.securitySolution.endpointResponseActions.getRunningProcesses.table.header.pid',
'xpack.securitySolution.endpointResponseActions.getProcesses.table.header.pid',
{ defaultMessage: 'PID' }
),
width: '5%',
@ -118,7 +138,7 @@ export const GetRunningProcessesActionResult = memo<
{
field: 'entity_id',
name: i18n.translate(
'xpack.securitySolution.endpointResponseActions.getRunningProcesses.table.header.enityId',
'xpack.securitySolution.endpointResponseActions.getProcesses.table.header.enityId',
{ defaultMessage: 'ENTITY ID' }
),
width: '30%',
@ -127,7 +147,7 @@ export const GetRunningProcessesActionResult = memo<
{
field: 'command',
name: i18n.translate(
'xpack.securitySolution.endpointResponseActions.getRunningProcesses.table.header.command',
'xpack.securitySolution.endpointResponseActions.getProcesses.table.header.command',
{ defaultMessage: 'COMMAND' }
),
width: '55%',
@ -148,19 +168,39 @@ export const GetRunningProcessesActionResult = memo<
return <ResultComponent showAs="pending" showTitle={false} />;
}
// Show errors if perform action fails
if (isError && apiError) {
return (
<ResultComponent
showAs="failure"
title={i18n.translate(
'xpack.securitySolution.endpointResponseActions.getProcesses.performApiErrorMessageTitle',
{ defaultMessage: 'Perform get processes action failed' }
)}
data-test-subj="performGetProcessesErrorCallout"
>
<FormattedMessage
id="xpack.securitySolution.endpointResponseActions.getProcesses.performApiErrorMessage"
defaultMessage="The following error was encountered: {error}"
values={{ error: apiError.message }}
/>
</ResultComponent>
);
}
// Show errors
if (completedActionDetails?.errors) {
return (
<ResultComponent
showAs="failure"
title={i18n.translate(
'xpack.securitySolution.endpointResponseActions.getRunningProcesses.errorMessageTitle',
{ defaultMessage: 'Get running processes action failed' }
'xpack.securitySolution.endpointResponseActions.getProcesses.errorMessageTitle',
{ defaultMessage: 'Get processes action failed' }
)}
data-test-subj="getRunningProcessesErrorCallout"
data-test-subj="getProcessesErrorCallout"
>
<FormattedMessage
id="xpack.securitySolution.endpointResponseActions.getRunningProcesses.errorMessage"
id="xpack.securitySolution.endpointResponseActions.getProcesses.errorMessage"
defaultMessage="The following errors were encountered: {errors}"
values={{ errors: completedActionDetails.errors.join(' | ') }}
/>
@ -170,9 +210,9 @@ export const GetRunningProcessesActionResult = memo<
// Show results
return (
<ResultComponent data-test-subj="getRunningProcessesSuccessCallout" showTitle={false}>
<ResultComponent data-test-subj="getProcessesSuccessCallout" showTitle={false}>
<StyledEuiBasicTable items={[...tableEntries]} columns={columns} />
</ResultComponent>
);
});
GetRunningProcessesActionResult.displayName = 'GetRunningProcessesActionResult';
GetProcessesActionResult.displayName = 'GetProcessesActionResult';

View file

@ -11,22 +11,19 @@ import { useQuery } from 'react-query';
import { useHttp } from '../../../common/lib/kibana';
import { resolvePathVariables } from '../../../common/utils/resolve_path_variables';
import { ACTION_DETAILS_ROUTE } from '../../../../common/endpoint/constants';
import type {
ActionDetailsApiResponse,
RunningProcessesEntry,
} from '../../../../common/endpoint/types';
import type { ActionDetailsApiResponse, ProcessesEntry } from '../../../../common/endpoint/types';
export const useGetActionDetails = <TOutputType extends object = object>(
actionId: string,
options: UseQueryOptions<ActionDetailsApiResponse<RunningProcessesEntry>, HttpFetchError> = {}
): UseQueryResult<ActionDetailsApiResponse<RunningProcessesEntry>, HttpFetchError> => {
options: UseQueryOptions<ActionDetailsApiResponse<ProcessesEntry>, HttpFetchError> = {}
): UseQueryResult<ActionDetailsApiResponse<ProcessesEntry>, HttpFetchError> => {
const http = useHttp();
return useQuery<ActionDetailsApiResponse<RunningProcessesEntry>, HttpFetchError>({
return useQuery<ActionDetailsApiResponse<ProcessesEntry>, HttpFetchError>({
queryKey: ['get-action-details', actionId],
...options,
queryFn: () => {
return http.get<ActionDetailsApiResponse<RunningProcessesEntry>>(
return http.get<ActionDetailsApiResponse<ProcessesEntry>>(
resolvePathVariables(ACTION_DETAILS_ROUTE, { action_id: actionId.trim() || 'undefined' })
);
},

View file

@ -8,35 +8,35 @@
import { useMutation, UseMutationOptions, UseMutationResult } from 'react-query';
import { HttpFetchError } from '@kbn/core/public';
import {
RunningProcessesRequestBody,
ProcessesRequestBody,
ResponseActionApiResponse,
RunningProcessesEntry,
ProcessesEntry,
} from '../../../../common/endpoint/types/actions';
import { GET_RUNNING_PROCESSES_ROUTE } from '../../../../common/endpoint/constants';
import { GET_PROCESSES_ROUTE } from '../../../../common/endpoint/constants';
import { KibanaServices } from '../../../common/lib/kibana';
/**
* Get running processes
* @param customOptions
*/
export const useSendGetEndpointRunningProcessesRequest = (
export const useSendGetEndpointProcessesRequest = (
customOptions?: UseMutationOptions<
ResponseActionApiResponse<RunningProcessesEntry>,
ResponseActionApiResponse<ProcessesEntry>,
HttpFetchError,
RunningProcessesRequestBody
ProcessesRequestBody
>
): UseMutationResult<
ResponseActionApiResponse<RunningProcessesEntry>,
ResponseActionApiResponse<ProcessesEntry>,
HttpFetchError,
RunningProcessesRequestBody
ProcessesRequestBody
> => {
return useMutation<
ResponseActionApiResponse<RunningProcessesEntry>,
ResponseActionApiResponse<ProcessesEntry>,
HttpFetchError,
RunningProcessesRequestBody
>((getRunningProcessesData: RunningProcessesRequestBody) => {
return KibanaServices.get().http.post<ResponseActionApiResponse<RunningProcessesEntry>>(
GET_RUNNING_PROCESSES_ROUTE,
ProcessesRequestBody
>((getRunningProcessesData: ProcessesRequestBody) => {
return KibanaServices.get().http.post<ResponseActionApiResponse<ProcessesEntry>>(
GET_PROCESSES_ROUTE,
{
body: JSON.stringify(getRunningProcessesData),
}

View file

@ -10,7 +10,7 @@ import { EndpointActionGenerator } from '../../../common/endpoint/data_generator
import {
ACTION_DETAILS_ROUTE,
ACTION_STATUS_ROUTE,
GET_RUNNING_PROCESSES_ROUTE,
GET_PROCESSES_ROUTE,
ENDPOINTS_ACTION_LIST_ROUTE,
ISOLATE_HOST_ROUTE,
UNISOLATE_HOST_ROUTE,
@ -24,7 +24,7 @@ import {
ActionListApiResponse,
HostIsolationResponse,
PendingActionsResponse,
RunningProcessesEntry,
ProcessesEntry,
ActionDetails,
} from '../../../common/endpoint/types';
@ -39,9 +39,7 @@ export type ResponseActionsHttpMocksInterface = ResponseProvidersInterface<{
agentPendingActionsSummary: (options: HttpFetchOptionsWithPath) => PendingActionsResponse;
runningProcesses: (
options: HttpFetchOptionsWithPath
) => ActionDetailsApiResponse<RunningProcessesEntry>;
processes: () => ActionDetailsApiResponse<ProcessesEntry>;
}>;
export const responseActionsHttpMocks = httpHandlerMockFactory<ResponseActionsHttpMocksInterface>([
@ -109,21 +107,21 @@ export const responseActionsHttpMocks = httpHandlerMockFactory<ResponseActionsHt
},
},
{
id: 'runningProcesses',
path: GET_RUNNING_PROCESSES_ROUTE,
id: 'processes',
path: GET_PROCESSES_ROUTE,
method: 'post',
handler: (): ActionDetailsApiResponse<RunningProcessesEntry> => {
handler: (): ActionDetailsApiResponse<ProcessesEntry> => {
const generator = new EndpointActionGenerator('seed');
const response = generator.generateActionDetails({
outputs: {
'1': {
type: 'json',
content: {
entries: generator.randomResponseActionRunningProcesses(3),
entries: generator.randomResponseActionProcesses(3),
},
},
},
}) as ActionDetails<RunningProcessesEntry>;
}) as ActionDetails<ProcessesEntry>;
return { data: response };
},

View file

@ -20,7 +20,7 @@ import {
EndpointActionResponse,
LogsEndpointActionResponse,
ActionResponseOutput,
RunningProcessesEntry,
ProcessesEntry,
} from '../../../common/endpoint/types';
import { EndpointActionListRequestQuery } from '../../../common/endpoint/schema/actions';
import { EndpointActionGenerator } from '../../../common/endpoint/data_generators/endpoint_action_generator';
@ -126,9 +126,9 @@ const getOutputDataIfNeeded = (
output: {
type: 'json',
content: {
entries: endpointActionGenerator.randomResponseActionRunningProcesses(100),
entries: endpointActionGenerator.randomResponseActionProcesses(100),
},
},
} as { output: ActionResponseOutput<RunningProcessesEntry> })
} as { output: ActionResponseOutput<ProcessesEntry> })
: {};
};

View file

@ -40,7 +40,7 @@ import {
ENDPOINT_ACTIONS_INDEX,
KILL_PROCESS_ROUTE,
SUSPEND_PROCESS_ROUTE,
GET_RUNNING_PROCESSES_ROUTE,
GET_PROCESSES_ROUTE,
ISOLATE_HOST_ROUTE,
UNISOLATE_HOST_ROUTE,
} from '../../../../common/endpoint/constants';
@ -401,7 +401,7 @@ describe('Response actions', () => {
});
it('sends the running-processes command payload from the running processes route', async () => {
const ctx = await callRoute(GET_RUNNING_PROCESSES_ROUTE, {
const ctx = await callRoute(GET_PROCESSES_ROUTE, {
body: { endpoint_ids: ['XYZ'] },
});
const actionDoc: EndpointAction = (
@ -527,7 +527,7 @@ describe('Response actions', () => {
it('handles running-processes', async () => {
const ctx = await callRoute(
GET_RUNNING_PROCESSES_ROUTE,
GET_PROCESSES_ROUTE,
{
body: { endpoint_ids: ['XYZ'] },
},

View file

@ -28,7 +28,7 @@ import {
failedFleetActionErrorCode,
KILL_PROCESS_ROUTE,
SUSPEND_PROCESS_ROUTE,
GET_RUNNING_PROCESSES_ROUTE,
GET_PROCESSES_ROUTE,
ISOLATE_HOST_ROUTE,
UNISOLATE_HOST_ROUTE,
ENDPOINT_ACTIONS_INDEX,
@ -147,7 +147,7 @@ export function registerResponseActionRoutes(
router.post(
{
path: GET_RUNNING_PROCESSES_ROUTE,
path: GET_PROCESSES_ROUTE,
validate: NoParametersRequestSchema,
options: { authRequired: true, tags: ['access:securitySolution'] },
},

View file

@ -153,7 +153,7 @@ describe('When using Actions service utilities', () => {
});
it('should return action outputs (if any) per agent id', () => {
const runningProcesses = endpointActionGenerator.randomResponseActionRunningProcesses(3);
const runningProcesses = endpointActionGenerator.randomResponseActionProcesses(3);
const endpointResponse = endpointActionGenerator.generateActivityLogActionResponse({
item: {
data: {

View file

@ -10,7 +10,7 @@ import {
ACTION_STATUS_ROUTE,
AGENT_POLICY_SUMMARY_ROUTE,
BASE_POLICY_RESPONSE_ROUTE,
GET_RUNNING_PROCESSES_ROUTE,
GET_PROCESSES_ROUTE,
HOST_METADATA_LIST_ROUTE,
ISOLATE_HOST_ROUTE,
ISOLATE_HOST_ROUTE_V2,
@ -88,7 +88,7 @@ export default function ({ getService }: FtrProviderContext) {
},
{
method: 'post',
path: GET_RUNNING_PROCESSES_ROUTE,
path: GET_PROCESSES_ROUTE,
body: { endpoint_ids: ['one'] },
},
{