Skip to content

Commit 8f64d83

Browse files
kibanamachineintxgoashokaditya
authored
[8.19] review of action response codes (elastic#240420) (elastic#240821)
# Backport This will backport the following commits from `main` to `8.19`: - [review of action response codes (elastic#240420)](elastic#240420) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Leszek Kubik","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-10-27T13:49:21Z","message":"review of action response codes (elastic#240420)\n\n## Summary\n\nI've reviewed action response codes. One was wrong, few were missing.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...\n\n---------\n\nCo-authored-by: Ashokaditya <[email protected]>","sha":"59cc9148f037f3d810e94a54f62195fd03dbe68d","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:all-open","v9.3.0"],"title":"review of action response codes","number":240420,"url":"https://github.com/elastic/kibana/pull/240420","mergeCommit":{"message":"review of action response codes (elastic#240420)\n\n## Summary\n\nI've reviewed action response codes. One was wrong, few were missing.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...\n\n---------\n\nCo-authored-by: Ashokaditya <[email protected]>","sha":"59cc9148f037f3d810e94a54f62195fd03dbe68d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/240420","number":240420,"mergeCommit":{"message":"review of action response codes (elastic#240420)\n\n## Summary\n\nI've reviewed action response codes. One was wrong, few were missing.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.\n\n### Identify risks\n\nDoes this PR introduce any risks? For example, consider risks like hard\nto test bugs, performance regression, potential of data loss.\n\nDescribe the risk, its severity, and mitigation for each identified\nrisk. Invite stakeholders and evaluate how to proceed before merging.\n\n- [ ] [See some risk\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\n- [ ] ...\n\n---------\n\nCo-authored-by: Ashokaditya <[email protected]>","sha":"59cc9148f037f3d810e94a54f62195fd03dbe68d"}}]}] BACKPORT--> Co-authored-by: Leszek Kubik <[email protected]> Co-authored-by: Ashokaditya <[email protected]>
1 parent 8d07de7 commit 8f64d83

File tree

6 files changed

+59
-33
lines changed

6 files changed

+59
-33
lines changed

x-pack/solutions/security/plugins/security_solution/common/endpoint/data_generators/endpoint_action_generator.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,11 @@ export class EndpointActionGenerator extends BaseDataGenerator {
451451

452452
randomScanFailureCode(): string {
453453
return this.randomChoice([
454-
'ra_scan_error_scan-invalid-input',
454+
'ra_scan_error_invalid-input',
455455
'ra_scan_error_not-found',
456-
'ra_scan_error_scan-queue-quota',
456+
'ra_scan_error_queue-quota',
457+
'ra_scan_error_processing',
458+
'ra_scan_error_processing-interrupted',
457459
]);
458460
}
459461

x-pack/solutions/security/plugins/security_solution/public/management/components/endpoint_action_failure_message/endpoint_action_failure_message.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ describe('EndpointActionFailureMessage', () => {
250250
const errorMessages = getByTestId(testId);
251251
expect(errorMessages).not.toBeNull();
252252
expect(errorMessages.textContent).toContain(
253-
'The following errors were encountered:Host: Fails-a-lotErrors: Too many scans are queued | Error info A | Error info B | Error info CHost: Errs-a-lotErrors: File path or folder was not found (404) | Error info P | Error info Q | Error info R'
253+
'The following errors were encountered:Host: Fails-a-lotErrors: Too many scans are queued | Error info A | Error info B | Error info CHost: Errs-a-lotErrors: File path or folder was not found | Error info P | Error info Q | Error info R'
254254
);
255255
});
256256

@@ -367,7 +367,7 @@ describe('EndpointActionFailureMessage', () => {
367367
const errorMessages = getByTestId(testId);
368368
expect(errorMessages).not.toBeNull();
369369
expect(errorMessages.textContent).toContain(
370-
'The following errors were encountered:Host: Errs-a-lotErrors: File path or folder was not found (404) | Error info P | Error info Q | Error info R'
370+
'The following errors were encountered:Host: Errs-a-lotErrors: File path or folder was not found | Error info P | Error info Q | Error info R'
371371
);
372372
});
373373

@@ -422,7 +422,7 @@ describe('EndpointActionFailureMessage', () => {
422422
const errorMessages = getByTestId(testId);
423423
expect(errorMessages).not.toBeNull();
424424
expect(errorMessages.textContent).toContain(
425-
'The following error was encountered:Host: Errs-a-lotErrors: File path or folder was not found (404)'
425+
'The following error was encountered:Host: Errs-a-lotErrors: File path or folder was not found'
426426
);
427427
});
428428
});

x-pack/solutions/security/plugins/security_solution/public/management/components/endpoint_responder/command_render_components/integration_tests/scan_action.test.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,19 @@ describe('When using scan action from response actions console', () => {
243243
});
244244
});
245245

246-
it.each(['ra_scan_error_not-found', 'ra_scan_error_invalid-input', 'ra_scan_error_queue-quota'])(
247-
'should show detailed error if `scan` failure returned code: %s',
248-
async (outputCode) => {
249-
const mockData = apiMocks.responseProvider.actionDetails({
250-
path: '/api/endpoint/action/agent-a',
251-
}).data;
252-
253-
const actionDetailsApiResponseMock: ReturnType<
254-
typeof apiMocks.responseProvider.actionDetails
255-
> = {
246+
it.each([
247+
'ra_scan_error_not-found',
248+
'ra_scan_error_invalid-input',
249+
'ra_scan_error_queue-quota',
250+
'ra_scan_error_processing',
251+
'ra_scan_error_processing-interrupted',
252+
])('should show detailed error if `scan` failure returned code: %s', async (outputCode) => {
253+
const mockData = apiMocks.responseProvider.actionDetails({
254+
path: '/api/endpoint/action/agent-a',
255+
}).data;
256+
257+
const actionDetailsApiResponseMock: ReturnType<typeof apiMocks.responseProvider.actionDetails> =
258+
{
256259
data: {
257260
...mockData,
258261
id: '123',
@@ -282,16 +285,15 @@ describe('When using scan action from response actions console', () => {
282285
},
283286
};
284287

285-
apiMocks.responseProvider.actionDetails.mockReturnValue(actionDetailsApiResponseMock);
286-
await render();
287-
await enterConsoleCommand(renderResult, user, 'scan --path="/error/path"');
288+
apiMocks.responseProvider.actionDetails.mockReturnValue(actionDetailsApiResponseMock);
289+
await render();
290+
await enterConsoleCommand(renderResult, user, 'scan --path="/error/path"');
288291

289-
await waitFor(() => {
290-
expect(renderResult.getByTestId('scan-actionFailure').textContent).toMatch(
291-
// RegExp below taken from: https://github.com/sindresorhus/escape-string-regexp/blob/main/index.js
292-
new RegExp(endpointActionResponseCodes[outputCode].replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'))
293-
);
294-
});
295-
}
296-
);
292+
await waitFor(() => {
293+
expect(renderResult.getByTestId('scan-actionFailure').textContent).toMatch(
294+
// RegExp below taken from: https://github.com/sindresorhus/escape-string-regexp/blob/main/index.js
295+
new RegExp(endpointActionResponseCodes[outputCode].replace(/[|\\{}()[\]^$+*?.]/g, '\\$&'))
296+
);
297+
});
298+
});
297299
});

x-pack/solutions/security/plugins/security_solution/public/management/components/endpoint_responder/command_render_components/integration_tests/upload_action.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ describe.skip('When using `upload` response action', () => {
220220

221221
it.each([
222222
'ra_upload_error_failure',
223-
'ra_upload_already-exists',
223+
'ra_upload_error_already-exists',
224224
'ra_upload_error_not-found',
225225
'ra_upload_error_not-permitted',
226226
'ra_upload_error_too-big',

x-pack/solutions/security/plugins/security_solution/public/management/components/endpoint_responder/lib/endpoint_action_response_codes.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ const CODES = Object.freeze({
8484
),
8585

8686
/**
87-
* Code will be used when the provided process can not be killed (for stability reasons).
88-
* Example: This occurs if you try to kill Endpoint Security
87+
* Code will be used when the provided process can not be suspended (for stability reasons).
88+
* Example: This occurs if you try to suspend Endpoint Security
8989
*/
9090
'ra_suspend-process_error_not-permitted': i18n.translate(
9191
'xpack.securitySolution.endpointActionResponseCodes.suspendProcess.notPermittedSuccess',
@@ -228,7 +228,7 @@ const CODES = Object.freeze({
228228

229229
// Dev:
230230
// File with the given name already exists and overwrite was not allowed.
231-
'ra_upload_already-exists': i18n.translate(
231+
'ra_upload_error_already-exists': i18n.translate(
232232
'xpack.securitySolution.endpointActionResponseCodes.upload.fileAlreadyExists',
233233
{
234234
defaultMessage:
@@ -270,6 +270,13 @@ const CODES = Object.freeze({
270270
{ defaultMessage: 'Failed to save file to disk or validate its integrity' }
271271
),
272272

273+
// Dev:
274+
// Fleet upload API was unreachable or misconfigured
275+
'ra_upload_error_upload-api-unreachable': i18n.translate(
276+
'xpack.securitySolution.endpointActionResponseCodes.upload.uploadApiUnreachable',
277+
{ defaultMessage: 'Failed to retrieve the file. File upload api (fleet-server) is unreachable' }
278+
),
279+
273280
// -----------------------------------------------------------------
274281
// SCAN CODES
275282
// -----------------------------------------------------------------
@@ -280,10 +287,10 @@ const CODES = Object.freeze({
280287
),
281288

282289
// Dev:
283-
// file path not found failure (404)
290+
// local disk path not found failure
284291
'ra_scan_error_not-found': i18n.translate(
285292
'xpack.securitySolution.endpointActionResponseCodes.scan.notFound',
286-
{ defaultMessage: 'File path or folder was not found (404)' }
293+
{ defaultMessage: 'File path or folder was not found' }
287294
),
288295

289296
// Dev:
@@ -293,6 +300,21 @@ const CODES = Object.freeze({
293300
{ defaultMessage: 'Too many scans are queued' }
294301
),
295302

303+
// Dev:
304+
// an error happened while scanning files, scan was not completed
305+
ra_scan_error_processing: i18n.translate(
306+
'xpack.securitySolution.endpointActionResponseCodes.scan.processingError',
307+
{ defaultMessage: 'An error occurred while processing the scan' }
308+
),
309+
310+
// Dev:
311+
// scan was interrupted, for example: system shutdown, endpoint service stop/restart.
312+
// Endpoint does not track yet scan progress, that's why it can't resume
313+
'ra_scan_error_processing-interrupted': i18n.translate(
314+
'xpack.securitySolution.endpointActionResponseCodes.scan.processingInterrupted',
315+
{ defaultMessage: 'The scan was interrupted' }
316+
),
317+
296318
// Dev:
297319
// scan success/completed
298320
ra_scan_success_done: i18n.translate(

x-pack/solutions/security/plugins/security_solution/public/management/cypress/e2e/response_actions/response_console/scan.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe(
122122

123123
cy.getByTestSubj('scan-actionFailure')
124124
.should('exist')
125-
.contains('File path or folder was not found (404)');
125+
.contains('File path or folder was not found');
126126
});
127127
});
128128
}

0 commit comments

Comments
 (0)