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

## Summary

Some add to timeline actions are missing version header when sending
requests. This is preventing user from adding alerts (of the rule types
below) to timeline - clicking `investigate in timeline` will throw a
`failed to create ... timeline` error. This PR adds version header to
api calls related to:

1. alert suppression
2. threshold rule
3. new term rule

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
christineweng 2023-10-25 11:48:36 -05:00 committed by GitHub
parent abcab94762
commit 8500600393
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])),
});