Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b7807c5
Const of Response actions API names to console command names
paul-tavares Apr 13, 2023
152b14a
refactor of EndpointAgentAndIsolationStatus component to handle all p…
paul-tavares Apr 13, 2023
b952023
moved `EndpointAgentAndIsolationStatus` component to `public/common/c…
paul-tavares Apr 13, 2023
9e08ccc
Fix pending actions flashing
paul-tavares Apr 13, 2023
8052443
Renamed `EndpointAgentAndIsolationStatus` to `EndpointAgentStatus`
paul-tavares Apr 13, 2023
beb8994
Replace host agent status in Agent list and details with new common a…
paul-tavares Apr 13, 2023
65760ce
Refactored Host Details to use new `<EndpointAgentStatus>`
paul-tavares Apr 13, 2023
c1c2d61
new `<EndpointAgentStatusById/>` component
paul-tavares Apr 13, 2023
b13126d
Updated timeline alert details to use `<EndpointAgentStatusById/>` co…
paul-tavares Apr 13, 2023
473c0f0
Delete `<AgentStatus>` component
paul-tavares Apr 13, 2023
80a4ec1
Delete `<EndpointHostIsolationStatus>` - no longer needed
paul-tavares Apr 13, 2023
e735c29
fix exports from `endpoint_agent_status`
paul-tavares Apr 13, 2023
68398c5
Updated test plan
paul-tavares Apr 13, 2023
adca9b3
Types: enhanced `pending_actions` to show known response actions ++ c…
paul-tavares Apr 14, 2023
c4add35
Test setup + initial set of tests for EndpointAgentStatus
paul-tavares Apr 14, 2023
905a19a
adjust type for EndpointPendingAction
paul-tavares Apr 14, 2023
ced8443
Remainder tests for EndpointAgentStatus
paul-tavares Apr 14, 2023
6939a71
some adjustments to tests
paul-tavares Apr 14, 2023
ac5cc59
Updated i18n translations
paul-tavares Apr 14, 2023
3f3293c
Added `generateHostInfo()` method to `EndpointMetadataGenerator`
paul-tavares Apr 15, 2023
177ae8b
Fix failing Host panel test
paul-tavares Apr 15, 2023
eaa7ea8
Fix failing test for host overview
paul-tavares Apr 15, 2023
86e3bd4
Fix test for responder header host component
paul-tavares Apr 16, 2023
0ac70c4
Fix endpoint list test by using correct data-test-subj
paul-tavares Apr 16, 2023
3425169
Fix types
paul-tavares Apr 16, 2023
16a20c8
Merge remote-tracking branch 'upstream/main' into task/olm-6308-add-n…
paul-tavares Apr 16, 2023
4947767
Delete unused selector and fix invalid type
paul-tavares Apr 16, 2023
44b2250
Sort pending action asc
paul-tavares Apr 16, 2023
7fba9ae
adjust logic for display of isolation state
paul-tavares Apr 17, 2023
5fcf556
Merge remote-tracking branch 'upstream/main' into task/olm-6308-add-n…
paul-tavares Apr 17, 2023
ff88091
fix responder test
paul-tavares Apr 17, 2023
becc156
feedback from ash
paul-tavares Apr 18, 2023
75d263d
Merge remote-tracking branch 'upstream/main' into task/olm-6308-add-n…
paul-tavares Apr 18, 2023
4800d1d
Add `pendingActions` as optional prop to EndpointAgentStatus
paul-tavares Apr 18, 2023
9d284bf
Changed Endpoint list to pass along pending actions to EndpointAgentS…
paul-tavares Apr 18, 2023
64e4549
change Endpoint Details to pass along pending actions to EndpointAgen…
paul-tavares Apr 18, 2023
64012d4
Merge remote-tracking branch 'upstream/main' into task/olm-6308-add-n…
paul-tavares Apr 18, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { merge, set } from 'lodash';
import { gte } from 'semver';
import type { EndpointCapabilities } from '../service/response_actions/constants';
import { BaseDataGenerator } from './base_data_generator';
import type { HostMetadataInterface, OSFields } from '../types';
import { EndpointStatus, HostPolicyResponseActionStatus } from '../types';
import type { HostMetadataInterface, OSFields, HostInfoInterface } from '../types';
import { EndpointStatus, HostPolicyResponseActionStatus, HostStatus } from '../types';

export interface GetCustomEndpointMetadataGeneratorOptions {
/** Version for agent/endpoint. Defaults to the stack version */
Expand Down Expand Up @@ -184,6 +184,31 @@ export class EndpointMetadataGenerator extends BaseDataGenerator {
return merge(hostMetadataDoc, overrides);
}

/** Generates the complete `HostInfo` as returned by a call to the Endpoint host details api */
generateHostInfo(overrides: DeepPartial<HostInfoInterface> = {}): HostInfoInterface {
const hostInfo: HostInfoInterface = {
metadata: this.generate(),
host_status: HostStatus.HEALTHY,
policy_info: {
endpoint: {
id: 'policy-123',
revision: 4,
},
agent: {
applied: {
id: 'policy-123',
revision: 4,
},
configured: {
id: 'policy-123',
revision: 4,
},
},
},
};
return merge(hostInfo, overrides);
}

protected randomOsFields(): OSFields {
return this.randomChoice([
EndpointMetadataGenerator.windowsOSFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ export const commandToRBACMap: Record<ConsoleResponseActionCommands, ResponseCon
execute: 'writeExecuteOperations',
});

export const RESPONSE_ACTION_API_COMMANDS_TO_CONSOLE_COMMAND_MAP = Object.freeze<
Record<ResponseActionsApiCommandNames, ConsoleResponseActionCommands>
>({
isolate: 'isolate',
unisolate: 'release',
execute: 'execute',
'get-file': 'get-file',
'running-processes': 'processes',
'kill-process': 'kill-process',
'suspend-process': 'suspend-process',
});
Comment on lines +81 to +89
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use lodash zipObject here e.g. Object.freeze(zipObject(RESPONSE_ACTION_API_COMMANDS_NAMES, CONSOLE_RESPONSE_ACTION_COMMANDS)). We'd need to ensure that the values in those two consts (RESPONSE_ACTION_API_COMMANDS_NAMES and CONSOLE_RESPONSE_ACTION_COMMANDS) are in the same order if you decide to use zipObject. Perhaps with comments.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had not known about that lodash function. I kind of prefer this here only because it's its clearer what the values are and I don['t have to worry about the ordering of items in the arrays.


// 4 hrs in seconds
// 4 * 60 * 60
export const DEFAULT_EXECUTE_ACTION_TIMEOUT = 14400;
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,9 @@ export interface ResponseActionApiResponse<TOutput extends object = object> {

export interface EndpointPendingActions {
agent_id: string;
pending_actions: {
/** Number of actions pending for each type. The `key` could be one of the `RESPONSE_ACTION_COMMANDS` values. */
/** Number of actions pending for each type */
pending_actions: Partial<Record<ResponseActionsApiCommandNames, number>> & {
// Defined any other key just in case we get back some other actions
[key: string]: number;
};
}
Expand Down
10 changes: 7 additions & 3 deletions x-pack/plugins/security_solution/common/endpoint/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,10 @@ export type PolicyInfo = Immutable<{
id: string;
}>;

export type HostInfo = Immutable<{
metadata: HostMetadata;
// Host Information as returned by the Host Details API.
// NOTE: `HostInfo` type is the original and defined as Immutable.
export interface HostInfoInterface {
metadata: HostMetadataInterface;
host_status: HostStatus;
policy_info?: {
agent: {
Expand All @@ -492,7 +494,9 @@ export type HostInfo = Immutable<{
*/
endpoint: PolicyInfo;
};
}>;
}

export type HostInfo = Immutable<HostInfoInterface>;

// Host metadata document streamed up to ES by the Endpoint running on host machines.
// NOTE: `HostMetadata` type is the original and defined as Immutable. If needing to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type { CloudEcs, HostEcs, OsEcs } from '@kbn/securitysolution-ecs';
import type { Hit, Hits, Maybe, SearchHit, StringOrNumber, TotalValue } from '../../../common';
import type { EndpointPendingActions, HostStatus } from '../../../../endpoint/types';
import type { EndpointPendingActions, HostInfo, HostStatus } from '../../../../endpoint/types';
import type { CommonFields } from '../..';

export enum HostPolicyResponseActionStatus {
Expand All @@ -33,6 +33,8 @@ export interface EndpointFields {
elasticAgentStatus?: Maybe<HostStatus>;
fleetAgentId?: Maybe<string>;
id?: Maybe<string>;
/** The complete Endpoint Host Details information (which also includes some of the fields above */
hostInfo?: HostInfo;
}

interface AgentFields {
Expand Down

This file was deleted.

This file was deleted.

Loading