[8.12] [EDR Workflows] Fix failing attach to case functionality when isolating/releasing a host (#172912) (#172968)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[EDR Workflows] Fix failing attach to case functionality when
isolating/releasing a host
(#172912)](https://github.com/elastic/kibana/pull/172912)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tomasz
Ciecierski","email":"tomasz.ciecierski@elastic.co"},"sourceCommit":{"committedDate":"2023-12-08T15:54:48Z","message":"[EDR
Workflows] Fix failing attach to case functionality when
isolating/releasing a host
(#172912)","sha":"a5528e3e7ded7ca3388cf552c60de4c30e521781","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Defend
Workflows","v8.12.0","v8.13.0","v8.11.3"],"number":172912,"url":"https://github.com/elastic/kibana/pull/172912","mergeCommit":{"message":"[EDR
Workflows] Fix failing attach to case functionality when
isolating/releasing a host
(#172912)","sha":"a5528e3e7ded7ca3388cf552c60de4c30e521781"}},"sourceBranch":"main","suggestedTargetBranches":["8.12","8.11"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/172912","number":172912,"mergeCommit":{"message":"[EDR
Workflows] Fix failing attach to case functionality when
isolating/releasing a host
(#172912)","sha":"a5528e3e7ded7ca3388cf552c60de4c30e521781"}},{"branch":"8.11","label":"v8.11.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Tomasz Ciecierski <tomasz.ciecierski@elastic.co>
This commit is contained in:
Kibana Machine 2023-12-08 12:25:54 -05:00 committed by GitHub
parent 05871ff18e
commit 3913a86c94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ import type { GetRelatedCasesByAlertResponse } from '@kbn/cases-plugin/common';
import { AttachmentType } from '@kbn/cases-plugin/common';
import type { CasesClient } from '@kbn/cases-plugin/server';
import type { BulkCreateArgs } from '@kbn/cases-plugin/server/client/attachments/types';
import { i18n } from '@kbn/i18n';
import { APP_ID } from '../../../../../common';
import type {
ImmutableObject,
@ -56,7 +57,7 @@ export const updateCases = async ({
const attachments = caseIDs.map(() => ({
type: AttachmentType.actions,
comment: createActionPayload.comment || '',
comment: createActionPayload.comment || EMPTY_COMMENT,
actions: {
targets,
type: createActionPayload.command,
@ -74,3 +75,10 @@ export const updateCases = async ({
);
}
};
export const EMPTY_COMMENT = i18n.translate(
'xpack.securitySolution.endpoint.updateCases.emptyComment',
{
defaultMessage: 'No comment provided',
}
);