Skip to content

Commit

Permalink
[Security Solution] Updating fleet action response data naming (#116214)
Browse files Browse the repository at this point in the history
  • Loading branch information
pzl authored Oct 26, 2021
1 parent 4b9c3da commit 38026a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ export const indexFleetActionsForHost = async (
const actionResponse = fleetActionGenerator.generateResponse({
action_id: action.action_id,
agent_id: agentId,
action_data: {
...action.data,
// add ack to 4/5th of fleet response
ack: fleetActionGenerator.randomFloat() < 0.8 ? true : undefined,
action_response: {
endpoint: {
// add ack to 4/5th of fleet response
ack: fleetActionGenerator.randomFloat() < 0.8 ? true : undefined,
},
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ export interface LogsEndpointActionResponse {
export interface EndpointActionData {
command: ISOLATION_ACTIONS;
comment?: string;
ack?: boolean;
}

export interface FleetActionResponseData {
endpoint?: {
ack?: boolean;
};
}

export interface EndpointAction {
Expand Down Expand Up @@ -93,6 +98,8 @@ export interface EndpointActionResponse {
completed_at: string;
error?: string;
action_data: EndpointActionData;
/* Response data from the Endpoint process -- only present in 7.16+ */
action_response?: FleetActionResponseData;
}

export interface EndpointActivityLogAction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const getActivityLog = async ({
};

const hasAckInResponse = (response: EndpointActionResponse): boolean => {
return typeof response.action_data.ack !== 'undefined';
return response.action_response?.endpoint?.ack ?? false;
};

// return TRUE if for given action_id/agent_id
Expand Down

0 comments on commit 38026a8

Please sign in to comment.