Skip to content

Commit

Permalink
[8.7] [Security Solution] Fixes bulk close alerts from exception flyo…
Browse files Browse the repository at this point in the history
…ut type bug (elastic#150765) (elastic#150784)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Security Solution] Fixes bulk close alerts from exception flyout
type bug (elastic#150765)](elastic#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
(elastic#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":"elastic#150765
Solution] Fixes bulk close alerts from exception flyout type bug
(elastic#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":"elastic#150765
Solution] Fixes bulk close alerts from exception flyout type bug
(elastic#150765)","sha":"216fb3a1806d67c35e7ee84353d4d6460f87ad85"}}]}]
BACKPORT-->

Co-authored-by: Davis Plumlee <56367316+dplumlee@users.noreply.github.com>
  • Loading branch information
kibanamachine and dplumlee committed Feb 14, 2023
1 parent be85a5f commit 3aaa46a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,16 @@ describe('Exception helpers', () => {
const result = prepareExceptionItemsForBulkClose(payload);
expect(result).toEqual(expected);
});

test("should strip out any comments in the exceptions for bulk close'", () => {
const exceptionItemWithComment = {
...getExceptionListItemSchemaMock(),
comments: getCommentsArrayMock(),
};
const payload = [exceptionItemWithComment];
const result = prepareExceptionItemsForBulkClose(payload);
expect(result).toEqual([getExceptionListItemSchemaMock()]);
});
});

describe('#lowercaseHashValues', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ export const prepareExceptionItemsForBulkClose = (
return {
...item,
entries: newEntries,
comments: [], // Strips out unneeded comments attribute for bulk close as they are not needed and are throwing type errors
};
} else {
return item;
return { ...item, comments: [] };
}
});
};
Expand Down

0 comments on commit 3aaa46a

Please sign in to comment.