Skip to content

Commit 6de4151

Browse files
[8.6] [Security Solution] Fixes bulk close alerts from exception flyout type bug (#150765) (#150783)
# Backport This will backport the following commits from `main` to `8.6`: - [[Security Solution] Fixes bulk close alerts from exception flyout type bug (#150765)](#150765) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Davis Plumlee","email":"56367316+dplumlee@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-02-09T21:00:07Z","message":"[Security Solution] Fixes bulk close alerts from exception flyout type bug (#150765)","sha":"216fb3a1806d67c35e7ee84353d4d6460f87ad85","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team: SecuritySolution","Team:Detection Alerts","backport:prev-minor","v8.7.0","v8.6.2","v8.8.0"],"number":150765,"url":"https://github.com/elastic/kibana/pull/150765","mergeCommit":{"message":"[Security Solution] Fixes bulk close alerts from exception flyout type bug (#150765)","sha":"216fb3a1806d67c35e7ee84353d4d6460f87ad85"}},"sourceBranch":"main","suggestedTargetBranches":["8.7","8.6"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.6","label":"v8.6.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/150765","number":150765,"mergeCommit":{"message":"[Security Solution] Fixes bulk close alerts from exception flyout type bug (#150765)","sha":"216fb3a1806d67c35e7ee84353d4d6460f87ad85"}}]}] BACKPORT--> Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
1 parent afa8d4e commit 6de4151

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,16 @@ describe('Exception helpers', () => {
384384
const result = prepareExceptionItemsForBulkClose(payload);
385385
expect(result).toEqual(expected);
386386
});
387+
388+
test("should strip out any comments in the exceptions for bulk close'", () => {
389+
const exceptionItemWithComment = {
390+
...getExceptionListItemSchemaMock(),
391+
comments: getCommentsArrayMock(),
392+
};
393+
const payload = [exceptionItemWithComment];
394+
const result = prepareExceptionItemsForBulkClose(payload);
395+
expect(result).toEqual([getExceptionListItemSchemaMock()]);
396+
});
387397
});
388398

389399
describe('#lowercaseHashValues', () => {

x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/utils/helpers.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ export const prepareExceptionItemsForBulkClose = (
154154
return {
155155
...item,
156156
entries: newEntries,
157+
comments: [], // Strips out unneeded comments attribute for bulk close as they are not needed and are throwing type errors
157158
};
158159
} else {
159-
return item;
160+
return { ...item, comments: [] };
160161
}
161162
});
162163
};

0 commit comments

Comments
 (0)