[8.11] [Security Solution] Add version header to alert table actions (#169731) (#169861)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Security Solution] Add version header to alert table actions
(#169731)](https://github.com/elastic/kibana/pull/169731)

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

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

<!--BACKPORT
[{"author":{"name":"christineweng","email":"18648970+christineweng@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-10-25T16:48:36Z","message":"[Security
Solution] Add version header to alert table actions (#169731)\n\n##
Summary\r\n\r\nSome add to timeline actions are missing version header
when sending\r\nrequests. This is preventing user from adding alerts (of
the rule types\r\nbelow) to timeline - clicking `investigate in
timeline` will throw a\r\n`failed to create ... timeline` error. This PR
adds version header to\r\napi calls related to:\r\n\r\n1. alert
suppression\r\n2. threshold rule\r\n3. new term rule\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"850060039330f4d8dd0c26e02ecee522d575e919","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat
Hunting","Team:Threat
Hunting:Investigations","v8.11.0","v8.12.0"],"number":169731,"url":"https://github.com/elastic/kibana/pull/169731","mergeCommit":{"message":"[Security
Solution] Add version header to alert table actions (#169731)\n\n##
Summary\r\n\r\nSome add to timeline actions are missing version header
when sending\r\nrequests. This is preventing user from adding alerts (of
the rule types\r\nbelow) to timeline - clicking `investigate in
timeline` will throw a\r\n`failed to create ... timeline` error. This PR
adds version header to\r\napi calls related to:\r\n\r\n1. alert
suppression\r\n2. threshold rule\r\n3. new term rule\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"850060039330f4d8dd0c26e02ecee522d575e919"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/169731","number":169731,"mergeCommit":{"message":"[Security
Solution] Add version header to alert table actions (#169731)\n\n##
Summary\r\n\r\nSome add to timeline actions are missing version header
when sending\r\nrequests. This is preventing user from adding alerts (of
the rule types\r\nbelow) to timeline - clicking `investigate in
timeline` will throw a\r\n`failed to create ... timeline` error. This PR
adds version header to\r\napi calls related to:\r\n\r\n1. alert
suppression\r\n2. threshold rule\r\n3. new term rule\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"850060039330f4d8dd0c26e02ecee522d575e919"}}]}]
BACKPORT-->

Co-authored-by: christineweng <18648970+christineweng@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2023-10-26 12:58:07 -04:00 committed by GitHub
parent 9fcc2577c9
commit 1d35c7bce2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -451,6 +451,7 @@ const createThresholdTimeline = async (
const alertResponse = await KibanaServices.get().http.fetch<
estypes.SearchResponse<{ '@timestamp': string; [key: string]: unknown }>
>(DETECTION_ENGINE_QUERY_SIGNALS_URL, {
version: '2023-10-31',
method: 'POST',
body: JSON.stringify(buildAlertsQuery([ecsData._id])),
});
@ -608,6 +609,7 @@ const createNewTermsTimeline = async (
const alertResponse = await KibanaServices.get().http.fetch<
estypes.SearchResponse<{ '@timestamp': string; [key: string]: unknown }>
>(DETECTION_ENGINE_QUERY_SIGNALS_URL, {
version: '2023-10-31',
method: 'POST',
body: JSON.stringify(buildAlertsQuery([ecsData._id])),
});
@ -773,6 +775,7 @@ const createSuppressedTimeline = async (
const alertResponse = await KibanaServices.get().http.fetch<
estypes.SearchResponse<{ '@timestamp': string; [key: string]: unknown }>
>(DETECTION_ENGINE_QUERY_SIGNALS_URL, {
version: '2023-10-31',
method: 'POST',
body: JSON.stringify(buildAlertsQuery([ecsData._id])),
});