From ddb1ca02e79db9db69160207b70dbce7d317bd1a Mon Sep 17 00:00:00 2001 From: Frank Hassanabad Date: Tue, 21 Jan 2020 17:04:18 -0700 Subject: [PATCH] [SIEM][Detection Engine] Critical blocker, adds need REST prefix for cloud (#55481) ## Summary * Adds needed `/` to the beginning of cloud requests from Kibana -> ES ### Checklist Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR. ~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~ ~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~ ~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~ ~~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~~ ~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~ ### For maintainers ~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~ - [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process) --- .../server/lib/detection_engine/index/create_bootstrap_index.ts | 2 +- .../siem/server/lib/detection_engine/index/delete_policy.ts | 2 +- .../siem/server/lib/detection_engine/index/get_policy_exists.ts | 2 +- .../siem/server/lib/detection_engine/index/set_policy.ts | 2 +- .../server/lib/detection_engine/privileges/read_privileges.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/create_bootstrap_index.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/create_bootstrap_index.ts index d7cb922b5b6c..dff6e7136bff 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/create_bootstrap_index.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/create_bootstrap_index.ts @@ -19,7 +19,7 @@ export const createBootstrapIndex = async ( index: string ): Promise => { return callWithRequest('transport.request', { - path: `${index}-000001`, + path: `/${index}-000001`, method: 'PUT', body: { aliases: { diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/delete_policy.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/delete_policy.ts index 92003f165d99..aa31c427ec84 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/delete_policy.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/delete_policy.ts @@ -11,7 +11,7 @@ export const deletePolicy = async ( policy: string ): Promise => { return callWithRequest('transport.request', { - path: `_ilm/policy/${policy}`, + path: `/_ilm/policy/${policy}`, method: 'DELETE', }); }; diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/get_policy_exists.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/get_policy_exists.ts index 7541c4217b38..d5ab1a10180c 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/get_policy_exists.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/get_policy_exists.ts @@ -12,7 +12,7 @@ export const getPolicyExists = async ( ): Promise => { try { await callWithRequest('transport.request', { - path: `_ilm/policy/${policy}`, + path: `/_ilm/policy/${policy}`, method: 'GET', }); // Return true that there exists a policy which is not 404 or some error diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/set_policy.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/set_policy.ts index 115f0af75898..fae28bab749c 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/set_policy.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/index/set_policy.ts @@ -12,7 +12,7 @@ export const setPolicy = async ( body: unknown ): Promise => { return callWithRequest('transport.request', { - path: `_ilm/policy/${policy}`, + path: `/_ilm/policy/${policy}`, method: 'PUT', body, }); diff --git a/x-pack/legacy/plugins/siem/server/lib/detection_engine/privileges/read_privileges.ts b/x-pack/legacy/plugins/siem/server/lib/detection_engine/privileges/read_privileges.ts index 3b84075b9e43..a93be40738e5 100644 --- a/x-pack/legacy/plugins/siem/server/lib/detection_engine/privileges/read_privileges.ts +++ b/x-pack/legacy/plugins/siem/server/lib/detection_engine/privileges/read_privileges.ts @@ -11,7 +11,7 @@ export const readPrivileges = async ( index: string ): Promise => { return callWithRequest('transport.request', { - path: `_security/user/_has_privileges`, + path: '/_security/user/_has_privileges', method: 'POST', body: { cluster: [