From 602584a22805dbd306a2183b53d795f15d1163d8 Mon Sep 17 00:00:00 2001 From: Kevin Logan <56395104+kevinlog@users.noreply.github.com> Date: Wed, 30 Dec 2020 16:30:20 -0500 Subject: [PATCH 1/5] [Security Solution] add a consistent spelling of ES in Policy Response (#87073) --- .../view/details/policy_response_friendly_names.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response_friendly_names.ts b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response_friendly_names.ts index 07ab38fd52776..312b83201045c 100644 --- a/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response_friendly_names.ts +++ b/x-pack/plugins/security_solution/public/management/pages/endpoint_hosts/view/details/policy_response_friendly_names.ts @@ -17,7 +17,7 @@ const policyResponses: Array<[string, string]> = [ 'configure_elasticsearch_connection', i18n.translate( 'xpack.securitySolution.endpoint.details.policyResponse.configure_elasticsearch_connection', - { defaultMessage: 'Configure Elastic Search Connection' } + { defaultMessage: 'Configure Elasticsearch Connection' } ), ], [ @@ -162,7 +162,7 @@ const policyResponses: Array<[string, string]> = [ 'read_elasticsearch_config', i18n.translate( 'xpack.securitySolution.endpoint.details.policyResponse.read_elasticsearch_config', - { defaultMessage: 'Read ElasticSearch Config' } + { defaultMessage: 'Read Elasticsearch Config' } ), ], [ From aecee9225731c27784b47c6b83e88a205c0db5f4 Mon Sep 17 00:00:00 2001 From: Diana Derevyankina <54894989+DziyanaDzeraviankina@users.noreply.github.com> Date: Thu, 31 Dec 2020 10:26:59 +0300 Subject: [PATCH 2/5] Enable prototype pollution protection in TSVB (#85952) * Enable prototype pollution protection in TSVB Closes #78908 * Update Dock API Changes * Replace logging failed in validateObject validation with 400 error * Move validateObject to kbn-std package and add a description * Update Doc API Changes * Rename validateObject function to ensureNoUnsafeProperties * Rename other validateObject occurrences Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../ensure_no_unsafe_properties.test.ts.snap | 0 .../src/ensure_no_unsafe_properties.test.ts | 8 ++++---- .../src/ensure_no_unsafe_properties.ts | 2 +- packages/kbn-std/src/index.ts | 1 + src/core/server/http/http_tools.ts | 4 ++-- .../server/http/prototype_pollution/index.ts | 20 ------------------- .../vis_type_timeseries/server/routes/vis.ts | 9 +++++++++ 7 files changed, 17 insertions(+), 27 deletions(-) rename src/core/server/http/prototype_pollution/__snapshots__/validate_object.test.ts.snap => packages/kbn-std/src/__snapshots__/ensure_no_unsafe_properties.test.ts.snap (100%) rename src/core/server/http/prototype_pollution/validate_object.test.ts => packages/kbn-std/src/ensure_no_unsafe_properties.test.ts (89%) rename src/core/server/http/prototype_pollution/validate_object.ts => packages/kbn-std/src/ensure_no_unsafe_properties.ts (97%) delete mode 100644 src/core/server/http/prototype_pollution/index.ts diff --git a/src/core/server/http/prototype_pollution/__snapshots__/validate_object.test.ts.snap b/packages/kbn-std/src/__snapshots__/ensure_no_unsafe_properties.test.ts.snap similarity index 100% rename from src/core/server/http/prototype_pollution/__snapshots__/validate_object.test.ts.snap rename to packages/kbn-std/src/__snapshots__/ensure_no_unsafe_properties.test.ts.snap diff --git a/src/core/server/http/prototype_pollution/validate_object.test.ts b/packages/kbn-std/src/ensure_no_unsafe_properties.test.ts similarity index 89% rename from src/core/server/http/prototype_pollution/validate_object.test.ts rename to packages/kbn-std/src/ensure_no_unsafe_properties.test.ts index 23d6c4ae3b49f..c12626b8d777e 100644 --- a/src/core/server/http/prototype_pollution/validate_object.test.ts +++ b/packages/kbn-std/src/ensure_no_unsafe_properties.test.ts @@ -17,14 +17,14 @@ * under the License. */ -import { validateObject } from './validate_object'; +import { ensureNoUnsafeProperties } from './ensure_no_unsafe_properties'; test(`fails on circular references`, () => { const foo: Record = {}; foo.myself = foo; expect(() => - validateObject({ + ensureNoUnsafeProperties({ payload: foo, }) ).toThrowErrorMatchingInlineSnapshot(`"circular reference detected"`); @@ -57,7 +57,7 @@ test(`fails on circular references`, () => { [property]: value, }; test(`can submit ${JSON.stringify(obj)}`, () => { - expect(() => validateObject(obj)).not.toThrowError(); + expect(() => ensureNoUnsafeProperties(obj)).not.toThrowError(); }); }); }); @@ -74,6 +74,6 @@ test(`fails on circular references`, () => { JSON.parse(`{ "foo": { "bar": { "constructor": { "prototype" : null } } } }`), ].forEach((value) => { test(`can't submit ${JSON.stringify(value)}`, () => { - expect(() => validateObject(value)).toThrowErrorMatchingSnapshot(); + expect(() => ensureNoUnsafeProperties(value)).toThrowErrorMatchingSnapshot(); }); }); diff --git a/src/core/server/http/prototype_pollution/validate_object.ts b/packages/kbn-std/src/ensure_no_unsafe_properties.ts similarity index 97% rename from src/core/server/http/prototype_pollution/validate_object.ts rename to packages/kbn-std/src/ensure_no_unsafe_properties.ts index cab6ce295ce92..47cbea5ecf3ee 100644 --- a/src/core/server/http/prototype_pollution/validate_object.ts +++ b/packages/kbn-std/src/ensure_no_unsafe_properties.ts @@ -31,7 +31,7 @@ const hasOwnProperty = (obj: any, property: string) => const isObject = (obj: any) => typeof obj === 'object' && obj !== null; // we're using a stack instead of recursion so we aren't limited by the call stack -export function validateObject(obj: any) { +export function ensureNoUnsafeProperties(obj: any) { if (!isObject(obj)) { return; } diff --git a/packages/kbn-std/src/index.ts b/packages/kbn-std/src/index.ts index c111428017539..a5b5088f9105f 100644 --- a/packages/kbn-std/src/index.ts +++ b/packages/kbn-std/src/index.ts @@ -27,4 +27,5 @@ export { withTimeout } from './promise'; export { isRelativeUrl, modifyUrl, getUrlOrigin, URLMeaningfulParts } from './url'; export { unset } from './unset'; export { getFlattenedObject } from './get_flattened_object'; +export { ensureNoUnsafeProperties } from './ensure_no_unsafe_properties'; export * from './rxjs_7'; diff --git a/src/core/server/http/http_tools.ts b/src/core/server/http/http_tools.ts index 8bec26f31fa26..f09f3dc2730a1 100644 --- a/src/core/server/http/http_tools.ts +++ b/src/core/server/http/http_tools.ts @@ -29,8 +29,8 @@ import Hoek from '@hapi/hoek'; import type { ServerOptions as TLSOptions } from 'https'; import type { ValidationError } from 'joi'; import uuid from 'uuid'; +import { ensureNoUnsafeProperties } from '@kbn/std'; import { HttpConfig } from './http_config'; -import { validateObject } from './prototype_pollution'; const corsAllowedHeaders = ['Accept', 'Authorization', 'Content-Type', 'If-None-Match', 'kbn-xsrf']; /** @@ -69,7 +69,7 @@ export function getServerOptions(config: HttpConfig, { configureTLS = true } = { // This is a default payload validation which applies to all LP routes which do not specify their own // `validate.payload` handler, in order to reduce the likelyhood of prototype pollution vulnerabilities. // (All NP routes are already required to specify their own validation in order to access the payload) - payload: (value) => Promise.resolve(validateObject(value)), + payload: (value) => Promise.resolve(ensureNoUnsafeProperties(value)), }, }, state: { diff --git a/src/core/server/http/prototype_pollution/index.ts b/src/core/server/http/prototype_pollution/index.ts deleted file mode 100644 index e1a33ffba155e..0000000000000 --- a/src/core/server/http/prototype_pollution/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { validateObject } from './validate_object'; diff --git a/src/plugins/vis_type_timeseries/server/routes/vis.ts b/src/plugins/vis_type_timeseries/server/routes/vis.ts index bba086720da0a..3ed9aaaaea226 100644 --- a/src/plugins/vis_type_timeseries/server/routes/vis.ts +++ b/src/plugins/vis_type_timeseries/server/routes/vis.ts @@ -19,6 +19,7 @@ import { IRouter, KibanaRequest } from 'kibana/server'; import { schema } from '@kbn/config-schema'; +import { ensureNoUnsafeProperties } from '@kbn/std'; import { getVisData, GetVisDataOptions } from '../lib/get_vis_data'; import { visPayloadSchema } from '../../common/vis_schema'; import { ROUTES } from '../../common/constants'; @@ -40,6 +41,14 @@ export const visDataRoutes = ( }, }, async (requestContext, request, response) => { + try { + ensureNoUnsafeProperties(request.body); + } catch (error) { + return response.badRequest({ + body: error.message, + }); + } + try { visPayloadSchema.validate(request.body); } catch (error) { From 1da5fcf4440890a7e706a7b6587a48a777db6782 Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 31 Dec 2020 12:16:33 -0700 Subject: [PATCH 3/5] [logstash] remove "upgrade" functionality now that .logstash is a system index (#87056) Co-authored-by: spalger --- .../upgrade_failure.test.js.snap | 1138 ----------------- .../upgrade_failure_actions.test.js.snap | 32 - .../upgrade_failure_title.test.js.snap | 23 - .../components/upgrade_failure/constants.js | 34 - .../components/upgrade_failure/index.js | 7 - .../upgrade_failure/upgrade_failure.js | 43 - .../upgrade_failure/upgrade_failure.test.js | 55 - .../upgrade_failure_actions.js | 36 - .../upgrade_failure_actions.test.js | 42 - .../upgrade_failure/upgrade_failure_title.js | 28 - .../upgrade_failure_title.test.js | 21 - .../logstash/public/application/index.tsx | 4 - .../public/application/pipeline_edit_view.tsx | 37 +- .../plugins/logstash/public/services/index.js | 1 - .../logstash/public/services/upgrade/index.js | 7 - .../services/upgrade/upgrade_service.js | 22 - .../plugins/logstash/server/routes/index.ts | 3 - .../logstash/server/routes/upgrade/index.ts | 7 - .../logstash/server/routes/upgrade/upgrade.ts | 46 - .../translations/translations/ja-JP.json | 7 - .../translations/translations/zh-CN.json | 7 - 21 files changed, 1 insertion(+), 1599 deletions(-) delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_title.test.js.snap delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/constants.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/index.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.test.js delete mode 100755 x-pack/plugins/logstash/public/services/upgrade/index.js delete mode 100755 x-pack/plugins/logstash/public/services/upgrade/upgrade_service.js delete mode 100644 x-pack/plugins/logstash/server/routes/upgrade/index.ts delete mode 100644 x-pack/plugins/logstash/server/routes/upgrade/upgrade.ts diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap b/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap deleted file mode 100644 index 63bb0c84d6711..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap +++ /dev/null @@ -1,1138 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UpgradeFailure component passes expected text for new pipeline 1`] = ` - -
- - -
- - } - body={ -

- Before you can add a pipeline, we need to upgrade your configuration. -

- } - title={ - - } - > -
- - - - - -
- -
- - - -
-
- -
- -

- Upgrade failed -

-
-
-
-
-
-
-
- -
- - -
-

- Before you can add a pipeline, we need to upgrade your configuration. -

-
-
- - - -
- - -
- - - -
- -
- - - - - -
-
- -
- - - -
-
-
-
-
-
- -
- - -
- -`; - -exports[`UpgradeFailure component passes expected text for not manual upgrade 1`] = ` - -
- - -
- - } - body={ -

- Before you can add a pipeline, we need to upgrade your configuration. -

- } - title={ - - } - > -
- - - - - -
- -
- - - -
-
- -
- -

- Time for an upgrade! -

-
-
-
-
-
-
-
- -
- - -
-

- Before you can add a pipeline, we need to upgrade your configuration. -

-
-
- - - -
- - -
- - - -
- -
- - - - - -
-
- -
- - - -
-
-
-
-
-
- -
- - -
- -`; - -exports[`UpgradeFailure component passes expected text for not new pipeline 1`] = ` - -
- - -
- - } - body={ -

- Before you can edit this pipeline, we need to upgrade your configuration. -

- } - title={ - - } - > -
- - - - - -
- -
- - - -
-
- -
- -

- Upgrade failed -

-
-
-
-
-
-
-
- -
- - -
-

- Before you can edit this pipeline, we need to upgrade your configuration. -

-
-
- - - -
- - -
- - - -
- -
- - - - - -
-
- -
- - - -
-
-
-
-
-
- -
- - -
- -`; - -exports[`UpgradeFailure component renders component as expected 1`] = ` -
- - - } - body={ -

- Before you can add a pipeline, we need to upgrade your configuration. -

- } - title={ - - } - /> -
-
-`; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap b/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap deleted file mode 100644 index 2be92ef29e71b..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap +++ /dev/null @@ -1,32 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UpgradeFailureActions component renders component as expected 1`] = ` - - - - upgrade button text - - - - - - - - -`; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_title.test.js.snap b/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_title.test.js.snap deleted file mode 100644 index df4503b34c964..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_title.test.js.snap +++ /dev/null @@ -1,23 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UpgradeFailureTitle component renders component as expected 1`] = ` - - - - - - -

- the Title -

-
-
-
-`; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/constants.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/constants.js deleted file mode 100644 index 99c727b3ad96a..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/constants.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { i18n } from '@kbn/i18n'; - -export const UPGRADE_FAILURE = { - TITLE: { - IS_MANUAL_UPGRADE: i18n.translate('xpack.logstash.upgradeFailedTitle', { - defaultMessage: 'Upgrade failed', - }), - NOT_MANUAL_UPGRADE: i18n.translate('xpack.logstash.notManualUpgradeTitle', { - defaultMessage: 'Time for an upgrade!', - }), - }, - MESSAGE: { - IS_NEW_PIPELINE: i18n.translate('xpack.logstash.newPipelineMessage', { - defaultMessage: 'Before you can add a pipeline, we need to upgrade your configuration.', - }), - NOT_NEW_PIPELINE: i18n.translate('xpack.logstash.notNewPipelineMessage', { - defaultMessage: 'Before you can edit this pipeline, we need to upgrade your configuration.', - }), - }, - UPGRADE_BUTTON_TEXT: { - IS_MANUAL_UPGRADE: i18n.translate('xpack.logstash.manualUpgradeButtonLabel', { - defaultMessage: 'Try again', - }), - NOT_MANUAL_UPGRADE: i18n.translate('xpack.logstash.notManualUpgradeButtonLabel', { - defaultMessage: 'Upgrade', - }), - }, -}; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/index.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/index.js deleted file mode 100644 index 0aa757bca5236..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { UpgradeFailure } from './upgrade_failure'; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.js deleted file mode 100644 index 52eefe490d2ee..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { EuiEmptyPrompt, EuiPageContent } from '@elastic/eui'; -import { UpgradeFailureTitle } from './upgrade_failure_title'; -import { UpgradeFailureActions } from './upgrade_failure_actions'; -import { UPGRADE_FAILURE } from './constants'; - -export function UpgradeFailure({ isNewPipeline, isManualUpgrade, onClose, onRetry }) { - const titleText = isManualUpgrade - ? UPGRADE_FAILURE.TITLE.IS_MANUAL_UPGRADE - : UPGRADE_FAILURE.TITLE.NOT_MANUAL_UPGRADE; - - const messageText = isNewPipeline - ? UPGRADE_FAILURE.MESSAGE.IS_NEW_PIPELINE - : UPGRADE_FAILURE.MESSAGE.NOT_NEW_PIPELINE; - - const upgradeButtonText = isManualUpgrade - ? UPGRADE_FAILURE.UPGRADE_BUTTON_TEXT.IS_MANUAL_UPGRADE - : UPGRADE_FAILURE.UPGRADE_BUTTON_TEXT.NOT_MANUAL_UPGRADE; - - return ( -
- - - } - title={} - body={

{messageText}

} - /> -
-
- ); -} diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js deleted file mode 100644 index fe93ddb22077c..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; -import { UpgradeFailure } from './upgrade_failure'; - -describe('UpgradeFailure component', () => { - let props; - let onClose; - let onRetry; - - beforeEach(() => { - onClose = jest.fn(); - onRetry = jest.fn(); - - props = { - isManualUpgrade: true, - isNewPipeline: true, - onClose, - onRetry, - }; - }); - - it('renders component as expected', () => { - const wrapper = shallowWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('passes expected text for new pipeline', () => { - const wrapper = mountWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('passes expected text for not new pipeline', () => { - props.isNewPipeline = false; - const wrapper = mountWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('passes expected text for not manual upgrade', () => { - props.isManualUpgrade = false; - const wrapper = mountWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('propogates onClose and onRetry functions to child', () => { - const wrapper = mountWithIntl(); - expect(wrapper.find('UpgradeFailureActions').props().onClose).toEqual(onClose); - expect(wrapper.find('UpgradeFailureActions').props().onRetry).toEqual(onRetry); - }); -}); diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.js deleted file mode 100644 index 7a3eaef45bb5b..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import { EuiButton, EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; - -export function UpgradeFailureActions({ onClose, onRetry, upgradeButtonText }) { - return ( - - - - {upgradeButtonText} - - - - - - - - - ); -} - -UpgradeFailureActions.propTypes = { - onClose: PropTypes.func.isRequired, - onRetry: PropTypes.func.isRequired, - upgradeButtonText: PropTypes.string.isRequired, -}; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js deleted file mode 100644 index 603ab0ff543b8..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; -import { UpgradeFailureActions } from './upgrade_failure_actions'; - -describe('UpgradeFailureActions component', () => { - let props; - let onClose; - let onRetry; - - beforeEach(() => { - onClose = jest.fn(); - onRetry = jest.fn(); - props = { - onClose, - onRetry, - upgradeButtonText: 'upgrade button text', - }; - }); - - it('renders component as expected', () => { - const wrapper = shallowWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('calls onRetry on update click', () => { - const wrapper = mountWithIntl(); - wrapper.find('EuiButton').simulate('click'); - expect(onRetry).toHaveBeenCalledTimes(1); - }); - - it('calls onClose on "Go back" click', () => { - const wrapper = mountWithIntl(); - wrapper.find('EuiButtonEmpty').simulate('click'); - expect(onClose).toHaveBeenCalledTimes(1); - }); -}); diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.js deleted file mode 100644 index 749c49ea2257e..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiTitle } from '@elastic/eui'; - -export function UpgradeFailureTitle({ titleText }) { - return ( - - - - - - -

{titleText}

-
-
-
- ); -} - -UpgradeFailureTitle.propTypes = { - titleText: PropTypes.string.isRequired, -}; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.test.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.test.js deleted file mode 100644 index 7fd5ad8f732b2..0000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.test.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { shallow } from 'enzyme'; -import { UpgradeFailureTitle } from './upgrade_failure_title'; - -describe('UpgradeFailureTitle component', () => { - let props; - beforeEach(() => { - props = { titleText: 'the Title' }; - }); - - it('renders component as expected', () => { - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/x-pack/plugins/logstash/public/application/index.tsx b/x-pack/plugins/logstash/public/application/index.tsx index 8d515ad6b3932..2cf1b0aaebd9f 100644 --- a/x-pack/plugins/logstash/public/application/index.tsx +++ b/x-pack/plugins/logstash/public/application/index.tsx @@ -17,7 +17,6 @@ import { MonitoringService, PipelineService, PipelinesService, - UpgradeService, // @ts-ignore } from '../services'; // @ts-ignore @@ -39,7 +38,6 @@ export const renderApp = async ( const monitoringService = new MonitoringService(core.http, isMonitoringEnabled, clusterService); const pipelinesService = new PipelinesService(core.http, monitoringService); const pipelineService = new PipelineService(core.http, pipelinesService); - const upgradeService = new UpgradeService(core.http); ReactDOM.render( @@ -77,7 +75,6 @@ export const renderApp = async ( logstashLicenseService={logstashLicenseService} pipelineService={pipelineService} toasts={core.notifications.toasts} - upgradeService={upgradeService} /> )} /> @@ -96,7 +93,6 @@ export const renderApp = async ( logstashLicenseService={logstashLicenseService} pipelineService={pipelineService} toasts={core.notifications.toasts} - upgradeService={upgradeService} id={match.params.id} /> )} diff --git a/x-pack/plugins/logstash/public/application/pipeline_edit_view.tsx b/x-pack/plugins/logstash/public/application/pipeline_edit_view.tsx index a36ef394f3327..3ad8927bcdafa 100644 --- a/x-pack/plugins/logstash/public/application/pipeline_edit_view.tsx +++ b/x-pack/plugins/logstash/public/application/pipeline_edit_view.tsx @@ -11,8 +11,6 @@ import { History } from 'history'; import { i18n } from '@kbn/i18n'; import { ToastsStart } from 'src/core/public'; -// @ts-ignore -import { UpgradeFailure } from './components/upgrade_failure'; // @ts-ignore import { PipelineEditor } from './components/pipeline_editor'; // @ts-ignore @@ -59,23 +57,9 @@ const usePipeline = ( return pipeline; }; -const useIsUpgraded = (upgradeService: any) => { - const [isUpgraded, setIsUpgraded] = useState(null); - const mounted = usePromise(); - - useLayoutEffect(() => { - mounted(upgradeService.executeUpgrade() as Promise).then((result) => - setIsUpgraded(result) - ); - }, [mounted, upgradeService]); - - return isUpgraded; -}; - interface EditProps { pipelineService: any; logstashLicenseService: any; - upgradeService: any; toasts: ToastsStart; history: History; setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; @@ -87,24 +71,16 @@ interface EditProps { export const PipelineEditView: React.FC = ({ pipelineService, logstashLicenseService, - upgradeService, toasts, history, setBreadcrumbs, id, }) => { const params = new URLSearchParams(history.location.search); - const shouldRetry = params.get('retry') === 'true'; const shouldClone = params.get('clone') === ''; const pipeline = usePipeline(pipelineService, logstashLicenseService, toasts, shouldClone, id); - const isUpgraded = useIsUpgraded(upgradeService); - const onRetry = useCallback(() => { - const newParams = new URLSearchParams(history.location.search); - newParams.set('retry', 'true'); - history.replace({ search: newParams.toString() }); - }, [history]); const close = useCallback(() => { history.push('/'); }, [history]); @@ -115,7 +91,7 @@ export const PipelineEditView: React.FC = ({ [history] ); - if (!pipeline || isUpgraded === null) { + if (!pipeline) { return null; } @@ -126,17 +102,6 @@ export const PipelineEditView: React.FC = ({ : Breadcrumbs.getPipelineEditBreadcrumbs(pipeline.id) ); - if (!isUpgraded) { - return ( - - ); - } - return ( response.is_upgraded) - .catch((e) => { - throw e.message; - }); - } -} diff --git a/x-pack/plugins/logstash/server/routes/index.ts b/x-pack/plugins/logstash/server/routes/index.ts index 0c7183b409055..422afbf7d411e 100644 --- a/x-pack/plugins/logstash/server/routes/index.ts +++ b/x-pack/plugins/logstash/server/routes/index.ts @@ -12,7 +12,6 @@ import { registerPipelineSaveRoute, } from './pipeline'; import { registerPipelinesListRoute, registerPipelinesDeleteRoute } from './pipelines'; -import { registerUpgradeRoute } from './upgrade'; export function registerRoutes(router: IRouter, security?: SecurityPluginSetup) { registerClusterLoadRoute(router); @@ -23,6 +22,4 @@ export function registerRoutes(router: IRouter, security?: SecurityPluginSetup) registerPipelinesListRoute(router); registerPipelinesDeleteRoute(router); - - registerUpgradeRoute(router); } diff --git a/x-pack/plugins/logstash/server/routes/upgrade/index.ts b/x-pack/plugins/logstash/server/routes/upgrade/index.ts deleted file mode 100644 index 3a5b0868b446b..0000000000000 --- a/x-pack/plugins/logstash/server/routes/upgrade/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { registerUpgradeRoute } from './upgrade'; diff --git a/x-pack/plugins/logstash/server/routes/upgrade/upgrade.ts b/x-pack/plugins/logstash/server/routes/upgrade/upgrade.ts deleted file mode 100644 index 2bd2c0f89e190..0000000000000 --- a/x-pack/plugins/logstash/server/routes/upgrade/upgrade.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import { IRouter } from 'src/core/server'; -import { wrapRouteWithLicenseCheck } from '../../../../licensing/server'; - -import { INDEX_NAMES } from '../../../common/constants'; -import { checkLicense } from '../../lib/check_license'; - -export function registerUpgradeRoute(router: IRouter) { - router.post( - { - path: '/api/logstash/upgrade', - validate: false, - }, - wrapRouteWithLicenseCheck( - checkLicense, - router.handleLegacyErrors(async (context, request, response) => { - const client = context.logstash!.esClient; - - const doesIndexExist = await client.callAsCurrentUser('indices.exists', { - index: INDEX_NAMES.PIPELINES, - }); - - // If index doesn't exist yet, there is no mapping to upgrade - if (doesIndexExist) { - await client.callAsCurrentUser('indices.putMapping', { - index: INDEX_NAMES.PIPELINES, - body: { - properties: { - pipeline_settings: { - dynamic: false, - type: 'object', - }, - }, - }, - }); - } - - return response.ok({ body: { is_upgraded: true } }); - }) - ) - ); -} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 1dbd6858815c4..116a81361699f 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -10907,11 +10907,6 @@ "xpack.logstash.managementSection.notPossibleToManagePipelinesMessage": "現在ライセンス情報が利用できないため Logstash パイプラインを使用できません。", "xpack.logstash.managementSection.pipelineCrudOperationsNotAllowedDescription": "ご使用の {licenseType} ライセンスは期限切れのため、Logstash パイプラインの編集、作成、削除ができません。", "xpack.logstash.managementSection.pipelinesTitle": "Logstashパイプライン", - "xpack.logstash.manualUpgradeButtonLabel": "再試行", - "xpack.logstash.newPipelineMessage": "パイプラインを追加する前に、構成をアップグレードする必要があります。", - "xpack.logstash.notManualUpgradeButtonLabel": "アップグレード", - "xpack.logstash.notManualUpgradeTitle": "アップグレードの時がやってきました!", - "xpack.logstash.notNewPipelineMessage": "このパイプラインを編集する前に、構成をアップグレードする必要があります。", "xpack.logstash.pipelineBatchDelayTooltip": "パイプラインイベントバッチを作成する際、それぞれのイベントでパイプラインワーカーにサイズの小さなバッチを送る前に何ミリ秒間待つかです。\n\nデフォルト値:50ms", "xpack.logstash.pipelineBatchSizeTooltip": "フィルターとアウトプットをを実行する前に各ワーカースレッドがインプットから収集するイベントの最低数です。基本的にバッチサイズが大きくなるほど効率が上がりますが、メモリーオーバーヘッドも大きくなります。このオプションを効率的に使用するには、LS_HEAP_SIZE 変数を設定して JVM のヒープサイズを増やす必要があるかもしれません。\n\nデフォルト値:125", "xpack.logstash.pipelineEditor.cancelButtonLabel": "キャンセル", @@ -10970,8 +10965,6 @@ "xpack.logstash.units.megabytesLabel": "メガバイト", "xpack.logstash.units.petabytesLabel": "ペタバイト", "xpack.logstash.units.terabytesLabel": "テラバイト", - "xpack.logstash.upgradeFailedTitle": "アップグレード失敗", - "xpack.logstash.upgradeFailureActions.goBackButtonLabel": "戻る", "xpack.logstash.upstreamPipelineArgumentMustContainAnIdPropertyErrorMessage": "upstreamPipeline 引数には id プロパティを含める必要があります", "xpack.logstash.workersTooltip": "パイプラインのフィルターとアウトプットステージを同時に実行するワーカーの数です。イベントが詰まってしまう場合や CPU が飽和状態ではない場合は、マシンの処理能力をより有効に活用するため、この数字を上げてみてください。\n\nデフォルト値:ホストの CPU コア数です", "xpack.maps.actionSelect.label": "アクション", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 216f8a36948f5..f03b720c8a77f 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -10920,11 +10920,6 @@ "xpack.logstash.managementSection.notPossibleToManagePipelinesMessage": "您不能管理 Logstash 管道,因为许可信息当前不可用。", "xpack.logstash.managementSection.pipelineCrudOperationsNotAllowedDescription": "您不能编辑、创建或删除您的 Logstash 管道,因为您的{licenseType}许可已过期。", "xpack.logstash.managementSection.pipelinesTitle": "Logstash 管道", - "xpack.logstash.manualUpgradeButtonLabel": "重试", - "xpack.logstash.newPipelineMessage": "在您可以添加管道之前,我们需要升级您的配置。", - "xpack.logstash.notManualUpgradeButtonLabel": "升级", - "xpack.logstash.notManualUpgradeTitle": "是时候升级了!", - "xpack.logstash.notNewPipelineMessage": "在您可以编辑此管道之前,我们需要升级您的配置。", "xpack.logstash.pipelineBatchDelayTooltip": "创建管道事件批时,将过小的批分派给管道工作线程之前要等候每个事件的时长(毫秒)。\n\n默认值:50ms", "xpack.logstash.pipelineBatchSizeTooltip": "单个工作线程在尝试执行其筛选和输出之前可以从输入收集的最大事件数目。较大的批大小通常更有效,但代价是内存开销也较大。您可能需要通过设置 LS_HEAP_SIZE 变量来增大 JVM 堆大小,从而有效利用该选项。\n\n默认值:125", "xpack.logstash.pipelineEditor.cancelButtonLabel": "取消", @@ -10983,8 +10978,6 @@ "xpack.logstash.units.megabytesLabel": "兆字节", "xpack.logstash.units.petabytesLabel": "万兆字节", "xpack.logstash.units.terabytesLabel": "兆兆字节", - "xpack.logstash.upgradeFailedTitle": "升级失败", - "xpack.logstash.upgradeFailureActions.goBackButtonLabel": "返回", "xpack.logstash.upstreamPipelineArgumentMustContainAnIdPropertyErrorMessage": "upstreamPipeline 参数必须包含 id 属性", "xpack.logstash.workersTooltip": "并行执行管道的筛选和输出阶段的工作线程数目。如果您发现事件出现积压或 CPU 未饱和,请考虑增大此数值,以更好地利用机器处理能力。\n\n默认值:主机的 CPU 核心数", "xpack.maps.actionSelect.label": "操作", From 0ec7689249ba531cf8949b015ffca0674829628c Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 1 Jan 2021 01:26:53 -0700 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=8D=BE=20update=20notice=20text=20for?= =?UTF-8?q?=202021?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NOTICE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE.txt b/NOTICE.txt index bf3cb4aa4ac87..2341a478cbda9 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Kibana source code with Kibana X-Pack source code -Copyright 2012-2020 Elasticsearch B.V. +Copyright 2012-2021 Elasticsearch B.V. --- Pretty handling of logarithmic axes. From 308827a67c70709b056c9ded38ddc50ef9cd06ad Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Fri, 1 Jan 2021 11:22:10 -0600 Subject: [PATCH 5/5] skip "should schedule actions on legacy alerts" #87010 --- .../security_and_spaces/tests/alerting/rbac_legacy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts index 2b25c82cc92e5..992d9210b9761 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts @@ -62,7 +62,7 @@ export default function alertTests({ getService }: FtrProviderContext) { }); }); - it('should schedule actions on legacy alerts', async () => { + it.skip('should schedule actions on legacy alerts', async () => { const reference = `alert:migrated-to-7.10:${user.username}`; const migratedAlertId = MIGRATED_ALERT_ID[user.username];