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

[SecuritySolution][Endpoint][Response Actions] Scan response actions history and errors #186284

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f0dbb37
Show failure message when error codes in outputs
ashokaditya Jun 17, 2024
e42a063
Typo correction
ashokaditya Jun 17, 2024
4c15090
Update scan.cy.ts
ashokaditya Jun 17, 2024
b5c5d73
Merge branch 'main' into task/dw-scan-response-actions-history-9213
ashokaditya Jun 18, 2024
74325a2
Merge branch 'main' into task/dw-scan-response-actions-history-9213
ashokaditya Jun 19, 2024
63db37d
fix type
ashokaditya Jun 19, 2024
e5df51c
show both failed output codes and error messages
ashokaditya Jun 20, 2024
685754a
tests and fixes
ashokaditya Jun 20, 2024
b4bb1af
improve error and output messages
ashokaditya Jun 21, 2024
5f628cd
fix
ashokaditya Jun 21, 2024
664f621
Merge branch 'main' into task/dw-scan-response-actions-history-9213
ashokaditya Jun 21, 2024
89c72ca
handle multi agent errors
ashokaditya Jun 21, 2024
6003a05
improve multi agent errors
ashokaditya Jun 23, 2024
c50279a
Merge branch 'main' into task/dw-scan-response-actions-history-9213
ashokaditya Jun 24, 2024
a9b4161
empty hostnames tests
ashokaditya Jun 24, 2024
13e2ad5
Merge branch 'task/dw-scan-response-actions-history-9213' of github.c…
ashokaditya Jun 24, 2024
0324a66
fix test mocks
ashokaditya Jun 24, 2024
3743a9a
Don't show Host/Error labels for single agents
ashokaditya Jun 24, 2024
ed26f44
fix test mock
ashokaditya Jun 24, 2024
e41caf5
Merge branch 'main' into task/dw-scan-response-actions-history-9213
ashokaditya Jun 24, 2024
852ac69
Unknown error message
ashokaditya Jun 24, 2024
c3f648d
simplify logic and add component tests
ashokaditya Jun 25, 2024
0880083
reduce complexity
ashokaditya Jun 25, 2024
2b259f6
fix
ashokaditya Jun 25, 2024
6184fda
missing tests for QA
ashokaditya Jun 25, 2024
a3a1751
update tests for QA
ashokaditya Jun 25, 2024
8b65ab7
Merge branch 'main' into task/dw-scan-response-actions-history-9213
ashokaditya Jun 26, 2024
9ac1efc
Merge branch 'task/dw-scan-response-actions-history-9213' of github.c…
ashokaditya Jun 26, 2024
0222ac6
fix tests
ashokaditya Jun 26, 2024
745be32
Update mocks.tsx
ashokaditya Jun 26, 2024
2bba513
Merge branch 'main' into task/dw-scan-response-actions-history-9213
ashokaditya Jun 27, 2024
af1d347
temp. skip `automated_response_actions.cy.ts`
ashokaditya Jun 27, 2024
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 @@ -27,7 +27,7 @@ import {
type ResponseActionGetFileParameters,
type ResponseActionScanOutputContent,
type ResponseActionsExecuteParameters,
type ResponseActionsScanParameters,
type ResponseActionScanParameters,
type ResponseActionUploadOutputContent,
type ResponseActionUploadParameters,
type WithAllKeys,
Expand Down Expand Up @@ -231,7 +231,7 @@ export class EndpointActionGenerator extends BaseDataGenerator {
comment: 'thisisacomment',
createdBy: 'auserid',
parameters: undefined,
outputs: {},
outputs: undefined,
agentState: {
'agent-a': {
errors: undefined,
Expand Down Expand Up @@ -265,8 +265,13 @@ export class EndpointActionGenerator extends BaseDataGenerator {
ResponseActionGetFileOutputContent,
ResponseActionGetFileParameters
>
).outputs = {
[details.agents[0]]: {
).outputs = details.agents.reduce<
ActionDetails<
ResponseActionGetFileOutputContent,
ResponseActionGetFileParameters
>['outputs']
>((acc = {}, agentId) => {
acc[agentId] = {
type: 'json',
content: {
code: 'ra_get-file_success',
Expand All @@ -281,8 +286,9 @@ export class EndpointActionGenerator extends BaseDataGenerator {
},
],
},
},
};
};
return acc;
}, {});
}
}

Expand All @@ -291,7 +297,7 @@ export class EndpointActionGenerator extends BaseDataGenerator {
(
details as unknown as ActionDetails<
ResponseActionScanOutputContent,
ResponseActionsScanParameters
ResponseActionScanParameters
>
).parameters = {
path: '/some/folder/to/scan',
Expand All @@ -302,16 +308,20 @@ export class EndpointActionGenerator extends BaseDataGenerator {
(
details as unknown as ActionDetails<
ResponseActionScanOutputContent,
ResponseActionsScanParameters
ResponseActionScanParameters
>
).outputs = {
[details.agents[0]]: {
).outputs = details.agents.reduce<
ActionDetails<ResponseActionScanOutputContent, ResponseActionScanParameters>['outputs']
>((acc = {}, agentId) => {
acc[agentId] = {
type: 'json',
content: {
code: 'ra_scan_success_done',
code: 'ra_scan_success',
},
},
};
};

return acc;
}, {});
}
}

Expand All @@ -336,14 +346,20 @@ export class EndpointActionGenerator extends BaseDataGenerator {
ResponseActionExecuteOutputContent,
ResponseActionsExecuteParameters
>
).outputs = {
[details.agents[0]]: this.generateExecuteActionResponseOutput({
).outputs = details.agents.reduce<
ActionDetails<
ResponseActionExecuteOutputContent,
ResponseActionsExecuteParameters
>['outputs']
>((acc = {}, agentId) => {
acc[agentId] = this.generateExecuteActionResponseOutput({
content: {
output_file_id: getFileDownloadId(details, details.agents[0]),
...(overrides.outputs?.[details.agents[0]]?.content ?? {}),
},
}),
};
});
return acc;
}, {});
}
}

Expand All @@ -360,16 +376,19 @@ export class EndpointActionGenerator extends BaseDataGenerator {
file_sha256: 'file-hash-sha-256',
};

uploadActionDetails.outputs = {
'agent-a': {
uploadActionDetails.outputs = details.agents.reduce<
ActionDetails<ResponseActionUploadOutputContent, ResponseActionUploadParameters>['outputs']
>((acc = {}, agentId) => {
acc[agentId] = {
type: 'json',
content: {
code: 'ra_upload_file-success',
path: '/path/to/uploaded/file',
disk_free_space: 1234567,
},
},
};
};
return acc;
}, {});
}

return merge(details, overrides as ActionDetails) as unknown as ActionDetails<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export interface ResponseActionsExecuteParameters {
timeout?: number;
}

export interface ResponseActionsScanParameters {
export interface ResponseActionScanParameters {
path: string;
}

Expand All @@ -211,7 +211,7 @@ export type EndpointActionDataParameterTypes =
| ResponseActionsExecuteParameters
| ResponseActionGetFileParameters
| ResponseActionUploadParameters
| ResponseActionsScanParameters;
| ResponseActionScanParameters;

/** Output content of the different response actions */
export type EndpointActionResponseDataOutput =
Expand Down
Loading