Skip to content

Commit

Permalink
Merge branch 'main' into serverless-role-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
thomheymann authored Nov 14, 2023
2 parents d8b0b01 + 3960204 commit 9449096
Show file tree
Hide file tree
Showing 98 changed files with 681 additions and 489 deletions.
4 changes: 3 additions & 1 deletion .buildkite/disabled_jest_configs.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
[]
[
"x-pack/plugins/index_management/jest.config.js"
]
12 changes: 8 additions & 4 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,14 @@ enabled:
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/workflows/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/date_numeric_types/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/date_numeric_types/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/keyword_text_long/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/keyword_text_long/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/ips_text_array/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/ips_text_array/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/ips/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/ips/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/keyword/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/keyword/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/long/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/long/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/text/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/exceptions/operators_data_types/text/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/rule_creation/configs/serverless.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/rule_creation/configs/ess.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/actions/configs/serverless.config.ts
Expand Down
23 changes: 19 additions & 4 deletions docs/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,29 @@ Review important information about the {kib} 8.x releases.
[[release-notes-8.11.1]]
== {kib} 8.11.1

The 8.11.1 release includes the following bug fixes.
For information about the {kib} 8.11.1 release, review the following information.

[float]
[[security-update-v8.11.1]]
=== Security updates

* An issue was discovered by Elastic whereby sensitive information is recorded
in {kib} logs in the event of an error. The error message recorded in the log
may contain account credentials for the `kibana_system` user, API Keys, and
credentials of {kib} end users.
+
The issue impacts {kib} versions before 7.17.15 and {kib} versions on or after
8.0.0 and before 8.11.1. The issue is resolved in {kib} 8.11.1 and {kib} 7.17.15.
+
For more information, see our related
https://discuss.elastic.co/t/8-11-1-7-17-15-security-update-esa-2023-25/347149[security
announcement].

[float]
[[fixes-v8.11.1]]
=== Bug Fixes

Fleet::
* Fixes inability to upgrade agents from version 8.10.4 to version 8.11 ({kibana-pull}170974[#170974]).
* Append space ID to security solution tag ({kibana-pull}170789[#170789]).
* Modify bulk unenroll to include inactive agents ({kibana-pull}170249[#170249]).
Lens & Visualizations::
Expand Down Expand Up @@ -799,10 +814,10 @@ For information about the {kib} 8.9.0 release, review the following information.
[%collapsible]
====
*Details* +
Changes to Lens visualizations do not appear in the saved object.
Changes to Lens visualizations do not appear in the saved object.
*Impact* +
When you remove fields from Lens visualizations, then save your changes, the removed fields continue to appear in the Lens visualization saved objects.
When you remove fields from Lens visualizations, then save your changes, the removed fields continue to appear in the Lens visualization saved objects.
For example, when you remove runtime fields from a Lens visualization and {kib}, then inspect the Lens visualization saved object, the runtime fields continue to appear and an error message appears.
*Workaround* +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ReactWrapper } from 'enzyme';
import { act } from 'react-dom/test-utils';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import { NotFoundPrompt } from '@kbn/shared-ux-prompt-not-found';
import { setStubKibanaServices } from '@kbn/embeddable-plugin/public/mocks';

import { DashboardContainerFactory } from '..';
import { DASHBOARD_CONTAINER_TYPE } from '../..';
Expand Down Expand Up @@ -168,6 +169,9 @@ describe('dashboard renderer', () => {
});

test('renders a 404 page when initial dashboard creation returns a savedObjectNotFound error', async () => {
// mock embeddable dependencies so that the embeddable panel renders
setStubKibanaServices();

// ensure that the first attempt at creating a dashboard results in a 404
const mockErrorEmbeddable = {
error: new SavedObjectNotFound('dashboard', 'gat em'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { UI_SETTINGS } from '../../../constants';
import { GetConfigFn } from '../../../types';
import { getSearchParams, getSearchParamsFromRequest } from './get_search_params';
import { createStubDataView } from '@kbn/data-views-plugin/common/data_views/data_view.stub';

function getConfigStub(config: any = {}): GetConfigFn {
return (key) => config[key];
Expand Down Expand Up @@ -46,4 +47,50 @@ describe('getSearchParams', () => {
query: 123,
});
});

test('sets expand_wildcards=all if data view has allowHidden=true', () => {
const getConfig = getConfigStub({
[UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE]: 'custom',
[UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE]: 'aaa',
});
const index = createStubDataView({
spec: {
allowHidden: true,
},
});
const searchParams = getSearchParamsFromRequest(
{
index,
body: {
query: 123,
track_total_hits: true,
},
},
{ getConfig }
);
expect(searchParams).toHaveProperty('expand_wildcards', 'all');
});

test('does not set expand_wildcards if data view has allowHidden=false', () => {
const getConfig = getConfigStub({
[UI_SETTINGS.COURIER_SET_REQUEST_PREFERENCE]: 'custom',
[UI_SETTINGS.COURIER_CUSTOM_REQUEST_PREFERENCE]: 'aaa',
});
const index = createStubDataView({
spec: {
allowHidden: false,
},
});
const searchParams = getSearchParamsFromRequest(
{
index,
body: {
query: 123,
track_total_hits: true,
},
},
{ getConfig }
);
expect(searchParams).not.toHaveProperty('expand_wildcards', 'all');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export function getSearchParamsFromRequest(
return {
index: searchRequest.index.title || searchRequest.index,
body,
// @ts-expect-error `track_total_hits` not allowed at top level for `typesWithBodyKey`
track_total_hits,
...(searchRequest.index?.allowHidden && { expand_wildcards: 'all' }),
...searchParams,
};
}
4 changes: 2 additions & 2 deletions src/plugins/data/common/search/strategies/ese_search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* Side Public License, v 1.
*/

import { ISearchOptions } from '../../types';
import { SearchSourceSearchOptions } from '../../search_source/types';

export const ENHANCED_ES_SEARCH_STRATEGY = 'ese';

export interface IAsyncSearchOptions extends ISearchOptions {
export interface IAsyncSearchOptions extends SearchSourceSearchOptions {
/**
* The number of milliseconds to wait between receiving a response and sending another request
* If not provided, then a default 1 second interval with back-off up to 5 seconds interval is used
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/public/search/errors/es_error.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('EsError', () => {
},
},
} as IEsError;
const esError = new EsError(error);
const esError = new EsError(error, () => {});

expect(typeof esError.attributes).toEqual('object');
expect(esError.attributes).toEqual(error.attributes);
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('EsError', () => {
},
},
} as IEsError;
const esError = new EsError(error);
const esError = new EsError(error, () => {});
expect(esError.message).toEqual(
'EsError: The supplied interval [2q] could not be parsed as a calendar interval.'
);
Expand Down
16 changes: 13 additions & 3 deletions src/plugins/data/public/search/errors/es_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import React from 'react';
import { EuiCodeBlock, EuiSpacer } from '@elastic/eui';
import { EuiButton, EuiCodeBlock, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { ApplicationStart } from '@kbn/core/public';
import { KbnError } from '@kbn/kibana-utils-plugin/common';
Expand All @@ -17,7 +17,7 @@ import { getRootCause } from './utils';
export class EsError extends KbnError {
readonly attributes: IEsError['attributes'];

constructor(protected readonly err: IEsError) {
constructor(protected readonly err: IEsError, private readonly openInInspector: () => void) {
super(
`EsError: ${
getRootCause(err?.attributes?.error)?.reason ||
Expand All @@ -27,7 +27,7 @@ export class EsError extends KbnError {
this.attributes = err.attributes;
}

public getErrorMessage(application: ApplicationStart) {
public getErrorMessage() {
if (!this.attributes?.error) {
return null;
}
Expand All @@ -45,4 +45,14 @@ export class EsError extends KbnError {
</>
);
}

public getActions(application: ApplicationStart) {
return [
<EuiButton key="viewRequestDetails" color="primary" onClick={this.openInInspector} size="s">
{i18n.translate('data.esError.viewDetailsButtonLabel', {
defaultMessage: 'View details',
})}
</EuiButton>,
];
}
}
20 changes: 12 additions & 8 deletions src/plugins/data/public/search/errors/painless_error.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ describe('PainlessError', () => {
});

it('Should show reason and code', () => {
const e = new PainlessError({
statusCode: 400,
message: 'search_phase_execution_exception',
attributes: {
error: searchPhaseException.error,
const e = new PainlessError(
{
statusCode: 400,
message: 'search_phase_execution_exception',
attributes: {
error: searchPhaseException.error,
},
},
});
const component = mount(e.getErrorMessage(startMock.application));
() => {}
);
const component = mount(e.getErrorMessage());

const failedShards = searchPhaseException.error.failed_shards![0];

Expand All @@ -41,6 +44,7 @@ describe('PainlessError', () => {
).getDOMNode();
expect(humanReadableError.textContent).toBe(failedShards?.reason.caused_by?.reason);

expect(component.find('EuiButton').length).toBe(1);
const actions = e.getActions(startMock.application);
expect(actions.length).toBe(2);
});
});
49 changes: 28 additions & 21 deletions src/plugins/data/public/search/errors/painless_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButton, EuiSpacer, EuiText, EuiCodeBlock } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiButtonEmpty, EuiSpacer, EuiText, EuiCodeBlock } from '@elastic/eui';
import { ApplicationStart } from '@kbn/core/public';
import type { DataView } from '@kbn/data-views-plugin/common';
import { IEsError, isEsError } from './types';
Expand All @@ -19,18 +18,12 @@ import { getRootCause } from './utils';
export class PainlessError extends EsError {
painlessStack?: string;
indexPattern?: DataView;
constructor(err: IEsError, indexPattern?: DataView) {
super(err);
constructor(err: IEsError, openInInspector: () => void, indexPattern?: DataView) {
super(err, openInInspector);
this.indexPattern = indexPattern;
}

public getErrorMessage(application: ApplicationStart) {
function onClick(indexPatternId?: string) {
application.navigateToApp('management', {
path: `/kibana/indexPatterns${indexPatternId ? `/patterns/${indexPatternId}` : ''}`,
});
}

public getErrorMessage() {
const rootCause = getRootCause(this.err.attributes?.error);
const scriptFromStackTrace = rootCause?.script_stack
? rootCause?.script_stack?.slice(-2).join('\n')
Expand All @@ -41,7 +34,6 @@ export class PainlessError extends EsError {
// fallback, show ES stacktrace
const painlessStack = rootCause?.script_stack ? rootCause?.script_stack.join('\n') : undefined;

const indexPatternId = this?.indexPattern?.id;
return (
<>
<EuiText size="s" data-test-subj="painlessScript">
Expand All @@ -54,25 +46,40 @@ export class PainlessError extends EsError {
})}
</EuiText>
<EuiSpacer size="s" />
<EuiSpacer size="s" />
{scriptFromStackTrace || painlessStack ? (
<EuiCodeBlock data-test-subj="painlessStackTrace" isCopyable={true} paddingSize="s">
{hasScript ? scriptFromStackTrace : painlessStack}
</EuiCodeBlock>
) : null}
{humanReadableError ? (
<EuiText data-test-subj="painlessHumanReadableError">{humanReadableError}</EuiText>
<EuiText size="s" data-test-subj="painlessHumanReadableError">
{humanReadableError}
</EuiText>
) : null}
<EuiSpacer size="s" />
<EuiSpacer size="s" />
<EuiText textAlign="right">
<EuiButton color="danger" onClick={() => onClick(indexPatternId)} size="s">
<FormattedMessage id="data.painlessError.buttonTxt" defaultMessage="Edit script" />
</EuiButton>
</EuiText>
</>
);
}

getActions(application: ApplicationStart) {
function onClick(indexPatternId?: string) {
application.navigateToApp('management', {
path: `/kibana/indexPatterns${indexPatternId ? `/patterns/${indexPatternId}` : ''}`,
});
}
const actions = super.getActions(application) ?? [];
actions.push(
<EuiButtonEmpty
key="editPainlessScript"
onClick={() => onClick(this?.indexPattern?.id)}
size="s"
>
{i18n.translate('data.painlessError.buttonTxt', {
defaultMessage: 'Edit script',
})}
</EuiButtonEmpty>
);
return actions;
}
}

export function isPainlessError(err: Error | IEsError) {
Expand Down
Loading

0 comments on commit 9449096

Please sign in to comment.