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

[Security Solution][Endpoint] Use a feature flag to use the new pending actions logic #117219

Merged
merged 7 commits into from
Nov 4, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const allowedExperimentalValues = Object.freeze({
uebaEnabled: false,
disableIsolationUIPendingStatuses: false,
riskyHostsEnabled: false,
pendingActionResponsesWithAck: true,
});

type ExperimentalConfigKeys = Array<keyof ExperimentalFeatures>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export const actionStatusRequestHandler = function (
const response = await getPendingActionCounts(
esClient,
endpointContext.service.getEndpointMetadataService(),
agentIDs
agentIDs,
endpointContext.experimentalFeatures.pendingActionResponsesWithAck
);

return res.ok({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ export const getPendingActionCounts = async (
esClient: ElasticsearchClient,
metadataService: EndpointMetadataService,
/** The Fleet Agent IDs to be checked */
agentIDs: string[]
agentIDs: string[],
isPendingActionResponsesWithAckEnabled: boolean
): Promise<EndpointPendingActions[]> => {
// retrieve the unexpired actions for the given hosts
const recentActions = await esClient
Expand Down Expand Up @@ -239,7 +240,8 @@ export const getPendingActionCounts = async (
});

const pendingActions: EndpointAction[] = recentActions.filter((action) => {
return ackResponseActionIdList.includes(action.action_id) // if has ack
return isPendingActionResponsesWithAckEnabled &&
ackResponseActionIdList.includes(action.action_id) // if has ack
ashokaditya marked this conversation as resolved.
Show resolved Hide resolved
? hasNoEndpointResponse({ action, agentId, indexedActionIds }) // then find responses in new index
: hasNoFleetResponse({
// else use the legacy way
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ export const getHostEndpoint = async (
? getPendingActionCounts(
esClient.asInternalUser,
endpointContext.service.getEndpointMetadataService(),
[fleetAgentId]
[fleetAgentId],
endpointContext.experimentalFeatures.pendingActionResponsesWithAck
)
.then((results) => {
return results[0].pending_actions;
Expand Down