mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [Update dependency @elastic/elasticsearch to ^8.17.0 (main) (#204175)](https://github.com/elastic/kibana/pull/204175) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"elastic-renovate-prod[bot]","email":"174716857+elastic-renovate-prod[bot]@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-28T06:35:59Z","message":"Update dependency @elastic/elasticsearch to ^8.17.0 (main) (#204175)\n\nCo-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>\nCo-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by: Kurt <kc13greiner@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a1a0f1820a8584250171e0424ef8d991892d8b17","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","Team:Operations","release_note:skip","v9.0.0","Team:DataDiscovery","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"title":"Update dependency @elastic/elasticsearch to ^8.17.0 (main)","number":204175,"url":"https://github.com/elastic/kibana/pull/204175","mergeCommit":{"message":"Update dependency @elastic/elasticsearch to ^8.17.0 (main) (#204175)\n\nCo-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>\nCo-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by: Kurt <kc13greiner@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a1a0f1820a8584250171e0424ef8d991892d8b17"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204175","number":204175,"mergeCommit":{"message":"Update dependency @elastic/elasticsearch to ^8.17.0 (main) (#204175)\n\nCo-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>\nCo-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by: Kurt <kc13greiner@users.noreply.github.com>\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"a1a0f1820a8584250171e0424ef8d991892d8b17"}}]}] BACKPORT--> Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
This commit is contained in:
parent
fafafe2113
commit
248e51a2ef
25 changed files with 250 additions and 275 deletions
|
@ -115,7 +115,7 @@
|
|||
"@elastic/datemath": "5.0.3",
|
||||
"@elastic/ebt": "^1.1.1",
|
||||
"@elastic/ecs": "^8.11.5",
|
||||
"@elastic/elasticsearch": "^8.16.0",
|
||||
"@elastic/elasticsearch": "^8.17.0",
|
||||
"@elastic/ems-client": "8.6.3",
|
||||
"@elastic/eui": "98.2.1-borealis.1",
|
||||
"@elastic/filesaver": "1.1.2",
|
||||
|
|
|
@ -28,6 +28,7 @@ export function getCommonDefaultAsyncSubmitParams(
|
|||
}
|
||||
): Pick<
|
||||
AsyncSearchSubmitRequest,
|
||||
// @ts-expect-error 'keep_alive' has been removed from the spec due to a misunderstanding, but it still works
|
||||
'keep_alive' | 'wait_for_completion_timeout' | 'keep_on_completion'
|
||||
> {
|
||||
const useSearchSessions =
|
||||
|
|
|
@ -53,7 +53,6 @@ export const enhancedEsSearchStrategyProvider = (
|
|||
request.params?.keep_alive ?? getDefaultAsyncGetParams(searchConfig, options).keep_alive;
|
||||
|
||||
const { body, headers } = await client.asyncSearch.status(
|
||||
// @ts-expect-error keep_alive was recently added and the types haven't been updated yet
|
||||
{ id: id!, keep_alive: keepAlive },
|
||||
{ ...options.transport, signal: options.abortSignal, meta: true }
|
||||
);
|
||||
|
|
|
@ -39,6 +39,7 @@ export async function getDefaultAsyncSubmitParams(
|
|||
): Promise<
|
||||
Pick<
|
||||
AsyncSearchSubmitRequest,
|
||||
// @ts-expect-error 'keep_alive' has been removed from the spec due to a misunderstanding, but it still works
|
||||
| 'batched_reduce_size'
|
||||
| 'ccs_minimize_roundtrips'
|
||||
| 'keep_alive'
|
||||
|
|
|
@ -30,7 +30,7 @@ export function getDefaultAsyncSubmitParams(
|
|||
*/
|
||||
disableSearchSessions: true,
|
||||
}),
|
||||
};
|
||||
} as Pick<SqlQueryRequest, 'keep_alive' | 'wait_for_completion_timeout' | 'keep_on_completion'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@ export type {
|
|||
AuthenticationProvider,
|
||||
} from './src/authentication';
|
||||
export type {
|
||||
RemoteClusterPrivilege,
|
||||
Role,
|
||||
RoleIndexPrivilege,
|
||||
RoleKibanaPrivilege,
|
||||
|
|
|
@ -39,13 +39,9 @@ export interface CrossClusterApiKey extends BaseApiKey {
|
|||
/**
|
||||
* Fixing up `estypes.SecurityApiKey` type since some fields are marked as optional even though they are guaranteed to be returned.
|
||||
*
|
||||
* TODO: Remove this type when `@elastic/elasticsearch` has been updated.
|
||||
* TODO: Remove this type when `@elastic/elasticsearch` has been updated to make `role_descriptors` required.
|
||||
*/
|
||||
export interface BaseApiKey extends estypes.SecurityApiKey {
|
||||
username: Required<estypes.SecurityApiKey>['username'];
|
||||
realm: Required<estypes.SecurityApiKey>['realm'];
|
||||
creation: Required<estypes.SecurityApiKey>['creation'];
|
||||
metadata: Required<estypes.SecurityApiKey>['metadata'];
|
||||
role_descriptors: Required<estypes.SecurityApiKey>['role_descriptors'];
|
||||
}
|
||||
|
||||
|
@ -119,8 +115,8 @@ interface BaseQueryApiKeyResult {
|
|||
/**
|
||||
* Interface representing a REST API key that is managed by Kibana.
|
||||
*/
|
||||
export interface ManagedApiKey extends BaseApiKey {
|
||||
type: 'managed';
|
||||
export interface ManagedApiKey extends Omit<BaseApiKey, 'type'> {
|
||||
type: estypes.SecurityApiKeyType | 'managed';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
export type { FeaturesPrivileges } from './features_privileges';
|
||||
export type { RawKibanaFeaturePrivileges, RawKibanaPrivileges } from './raw_kibana_privileges';
|
||||
export type {
|
||||
RemoteClusterPrivilege,
|
||||
Role,
|
||||
RoleKibanaPrivilege,
|
||||
RoleIndexPrivilege,
|
||||
|
|
|
@ -28,9 +28,11 @@ export interface RoleKibanaPrivilege {
|
|||
_reserved?: string[];
|
||||
}
|
||||
|
||||
export type RemoteClusterPrivilege = 'monitor_enrich' | 'monitor_stats';
|
||||
|
||||
export interface RoleRemoteClusterPrivilege {
|
||||
clusters: string[];
|
||||
privileges: string[];
|
||||
clusters: string | string[];
|
||||
privileges: RemoteClusterPrivilege[];
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
|
|
|
@ -223,7 +223,10 @@ export interface HealthIndicatorAction {
|
|||
}
|
||||
|
||||
export interface EnrichedDeprecationInfo
|
||||
extends Omit<estypes.MigrationDeprecationsDeprecation, 'level'> {
|
||||
extends Omit<
|
||||
estypes.MigrationDeprecationsDeprecation,
|
||||
'level' | 'resolve_during_rolling_upgrade'
|
||||
> {
|
||||
type: keyof estypes.MigrationDeprecationsResponse | 'health_indicator' | 'data_streams';
|
||||
isCritical: boolean;
|
||||
status?: estypes.HealthReportIndicatorHealthStatus;
|
||||
|
|
|
@ -16,7 +16,7 @@ interface Actions {
|
|||
actions: Action[];
|
||||
}
|
||||
|
||||
type EsMetadata = Actions & {
|
||||
export type EsMetadata = Actions & {
|
||||
[key: string]: string;
|
||||
};
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import * as healthIndicatorsMock from '../__fixtures__/health_indicators';
|
|||
import * as esMigrationsMock from '../__fixtures__/es_deprecations';
|
||||
import type { FeatureSet } from '../../../common/types';
|
||||
import { getESUpgradeStatus } from '.';
|
||||
import { MigrationDeprecationsResponse } from '@elastic/elasticsearch/lib/api/types';
|
||||
const fakeIndexNames = Object.keys(fakeDeprecations.index_settings);
|
||||
|
||||
describe('getESUpgradeStatus', () => {
|
||||
|
@ -117,7 +118,6 @@ describe('getESUpgradeStatus', () => {
|
|||
message: 'Index created before 7.0',
|
||||
url: 'https://',
|
||||
details: '...',
|
||||
// @ts-expect-error not full interface
|
||||
resolve_during_rolling_upgrade: false,
|
||||
},
|
||||
],
|
||||
|
@ -168,7 +168,7 @@ describe('getESUpgradeStatus', () => {
|
|||
const mockResponse = {
|
||||
...esMigrationsMock.getMockEsDeprecations(),
|
||||
...esMigrationsMock.getMockDataStreamDeprecations(),
|
||||
};
|
||||
} as MigrationDeprecationsResponse;
|
||||
esClient.asCurrentUser.migration.deprecations.mockResponse(mockResponse);
|
||||
|
||||
const enabledUpgradeStatus = await getESUpgradeStatus(esClient, { ...featureSet });
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
convertFeaturesToIndicesArray,
|
||||
getESSystemIndicesMigrationStatus,
|
||||
} from '../es_system_indices_migration';
|
||||
import { getCorrectiveAction } from './get_corrective_actions';
|
||||
import { type EsMetadata, getCorrectiveAction } from './get_corrective_actions';
|
||||
import { esIndicesStateCheck } from '../es_indices_state_check';
|
||||
|
||||
/**
|
||||
|
@ -35,9 +35,7 @@ const createBaseMigrationDeprecation = (
|
|||
message,
|
||||
url,
|
||||
level,
|
||||
// @ts-expect-error @elastic/elasticsearch _meta not available yet in MigrationDeprecationInfoResponse
|
||||
_meta: metadata,
|
||||
// @ts-expect-error @elastic/elasticsearch resolve_during_rolling_upgrade not available yet in MigrationDeprecationInfoResponse
|
||||
resolve_during_rolling_upgrade: resolveDuringUpgrade,
|
||||
} = migrationDeprecation;
|
||||
|
||||
|
@ -137,7 +135,7 @@ export const getEnrichedDeprecations = async (
|
|||
.map((deprecation) => {
|
||||
const correctiveAction = getCorrectiveAction(
|
||||
deprecation.message,
|
||||
deprecation.metadata,
|
||||
deprecation.metadata as EsMetadata,
|
||||
deprecation.index!
|
||||
);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import {
|
||||
ClusterPutComponentTemplateRequest,
|
||||
IndicesGetIndexTemplateIndexTemplateItem,
|
||||
type IndicesPutIndexTemplateRequest,
|
||||
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { Logger, ElasticsearchClient } from '@kbn/core/server';
|
||||
import { asyncForEach } from '@kbn/std';
|
||||
|
@ -59,7 +60,7 @@ const getIndexTemplatesUsingComponentTemplate = async (
|
|||
'index.mapping.total_fields.limit': totalFieldsLimit,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as IndicesPutIndexTemplateRequest['body'],
|
||||
}),
|
||||
{ logger }
|
||||
);
|
||||
|
|
|
@ -9,7 +9,10 @@ import React from 'react';
|
|||
|
||||
import { coreMock } from '@kbn/core/public/mocks';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import type { SecurityLicenseFeatures } from '@kbn/security-plugin-types-common';
|
||||
import type {
|
||||
RemoteClusterPrivilege,
|
||||
SecurityLicenseFeatures,
|
||||
} from '@kbn/security-plugin-types-common';
|
||||
import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers';
|
||||
import '@kbn/code-editor-mock/jest_helper';
|
||||
|
||||
|
@ -69,7 +72,7 @@ test('it renders an RemoteClusterPrivilegesForm for each remote cluster privileg
|
|||
},
|
||||
{
|
||||
clusters: ['cluster5', 'cluster6'],
|
||||
privileges: ['monitor_enrich', 'custom-privilege'],
|
||||
privileges: ['monitor_enrich', 'monitor_stats'],
|
||||
},
|
||||
],
|
||||
indices: [],
|
||||
|
@ -98,11 +101,11 @@ test('it renders fields as disabled when not editable', async () => {
|
|||
remote_cluster: [
|
||||
{
|
||||
clusters: ['cluster1', 'cluster2'],
|
||||
privileges: ['monitor_enrich'],
|
||||
privileges: ['monitor_enrich'] as RemoteClusterPrivilege[],
|
||||
},
|
||||
{
|
||||
clusters: ['cluster3', 'cluster4'],
|
||||
privileges: ['monitor_enrich'],
|
||||
privileges: ['monitor_enrich'] as RemoteClusterPrivilege[],
|
||||
},
|
||||
],
|
||||
indices: [],
|
||||
|
@ -144,11 +147,11 @@ test('it renders fields as disabled when `allowRemoteClusterPrivileges` is set t
|
|||
remote_cluster: [
|
||||
{
|
||||
clusters: ['cluster1', 'cluster2'],
|
||||
privileges: ['monitor_enrich'],
|
||||
privileges: ['monitor_enrich'] as RemoteClusterPrivilege[],
|
||||
},
|
||||
{
|
||||
clusters: ['cluster3', 'cluster4'],
|
||||
privileges: ['monitor_enrich'],
|
||||
privileges: ['monitor_enrich'] as RemoteClusterPrivilege[],
|
||||
},
|
||||
],
|
||||
indices: [],
|
||||
|
|
|
@ -10,6 +10,7 @@ import type { EuiComboBoxProps } from '@elastic/eui';
|
|||
import React from 'react';
|
||||
|
||||
import '@kbn/code-editor-mock/jest_helper';
|
||||
import type { RemoteClusterPrivilege } from '@kbn/security-plugin-types-common';
|
||||
import { mountWithIntl, shallowWithIntl } from '@kbn/test-jest-helpers';
|
||||
|
||||
import { RemoteClusterPrivilegesForm } from './remote_cluster_privileges_form';
|
||||
|
@ -141,7 +142,7 @@ describe('delete button', () => {
|
|||
const props = {
|
||||
remoteClusterPrivilege: {
|
||||
clusters: ['cluster1'],
|
||||
privileges: ['monitor_enrich'],
|
||||
privileges: ['monitor_enrich'] as RemoteClusterPrivilege[],
|
||||
},
|
||||
formIndex: 0,
|
||||
availableRemoteClusterPrivileges: ['monitor_enrich'],
|
||||
|
|
|
@ -22,6 +22,7 @@ import React, { Fragment, useCallback } from 'react';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import type { Cluster } from '@kbn/remote-clusters-plugin/public';
|
||||
import type { RemoteClusterPrivilege } from '@kbn/security-plugin-types-common';
|
||||
import { euiThemeVars } from '@kbn/ui-theme';
|
||||
|
||||
import { RemoteClusterComboBox } from './remote_clusters_combo_box';
|
||||
|
@ -54,7 +55,7 @@ export const RemoteClusterPrivilegesForm: React.FunctionComponent<Props> = ({
|
|||
}) => {
|
||||
const onCreateClusterOption = useCallback(
|
||||
(option: string) => {
|
||||
const nextClusters = (remoteClusterPrivilege.clusters ?? []).concat([option]);
|
||||
const nextClusters = ([...remoteClusterPrivilege.clusters] ?? []).concat([option]);
|
||||
|
||||
onChange({
|
||||
...remoteClusterPrivilege,
|
||||
|
@ -79,7 +80,7 @@ export const RemoteClusterPrivilegesForm: React.FunctionComponent<Props> = ({
|
|||
(newPrivileges: EuiComboBoxOptionOption[]) => {
|
||||
onChange({
|
||||
...remoteClusterPrivilege,
|
||||
privileges: newPrivileges.map(fromOption),
|
||||
privileges: newPrivileges.map(fromOption) as RemoteClusterPrivilege[],
|
||||
});
|
||||
},
|
||||
[remoteClusterPrivilege, onChange]
|
||||
|
@ -116,7 +117,7 @@ export const RemoteClusterPrivilegesForm: React.FunctionComponent<Props> = ({
|
|||
>
|
||||
<RemoteClusterComboBox
|
||||
data-test-subj={`remoteClusterClustersInput${formIndex}`}
|
||||
selectedOptions={(remoteClusterPrivilege.clusters ?? []).map(toOption)}
|
||||
selectedOptions={([...remoteClusterPrivilege.clusters] ?? []).map(toOption)}
|
||||
onCreateOption={onCreateClusterOption}
|
||||
onChange={onClustersChange}
|
||||
isDisabled={isRoleReadOnly}
|
||||
|
|
|
@ -331,14 +331,12 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_cluster: undefined,
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [],
|
||||
},
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_cluster: undefined,
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -366,19 +364,17 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['all'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
],
|
||||
},
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['all'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -409,19 +405,17 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['feature_foo.foo'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
],
|
||||
},
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['feature_foo.foo'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -450,19 +444,17 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['all'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
],
|
||||
},
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['all'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -532,52 +524,50 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['all', 'read'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['all', 'read'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
{
|
||||
application,
|
||||
privileges: ['space_all', 'space_read'],
|
||||
resources: ['space:test-space-1', 'space:test-space-2'],
|
||||
},
|
||||
{
|
||||
application,
|
||||
privileges: ['feature_foo.foo-privilege-1', 'feature_foo.foo-privilege-2'],
|
||||
resources: ['space:test-space-3'],
|
||||
},
|
||||
],
|
||||
cluster: ['test-cluster-privilege'],
|
||||
description: 'test description',
|
||||
indices: [
|
||||
{
|
||||
field_security: {
|
||||
grant: ['test-field-security-grant-1', 'test-field-security-grant-2'],
|
||||
except: ['test-field-security-except-1', 'test-field-security-except-2'],
|
||||
},
|
||||
{
|
||||
application,
|
||||
privileges: ['space_all', 'space_read'],
|
||||
resources: ['space:test-space-1', 'space:test-space-2'],
|
||||
names: ['test-index-name-1', 'test-index-name-2'],
|
||||
privileges: ['test-index-privilege-1', 'test-index-privilege-2'],
|
||||
query: `{ "match": { "title": "foo" } }`,
|
||||
},
|
||||
],
|
||||
remote_indices: [
|
||||
{
|
||||
field_security: {
|
||||
grant: ['test-field-security-grant-1', 'test-field-security-grant-2'],
|
||||
except: ['test-field-security-except-1', 'test-field-security-except-2'],
|
||||
},
|
||||
{
|
||||
application,
|
||||
privileges: ['feature_foo.foo-privilege-1', 'feature_foo.foo-privilege-2'],
|
||||
resources: ['space:test-space-3'],
|
||||
},
|
||||
],
|
||||
cluster: ['test-cluster-privilege'],
|
||||
description: 'test description',
|
||||
indices: [
|
||||
{
|
||||
field_security: {
|
||||
grant: ['test-field-security-grant-1', 'test-field-security-grant-2'],
|
||||
except: ['test-field-security-except-1', 'test-field-security-except-2'],
|
||||
},
|
||||
names: ['test-index-name-1', 'test-index-name-2'],
|
||||
privileges: ['test-index-privilege-1', 'test-index-privilege-2'],
|
||||
query: `{ "match": { "title": "foo" } }`,
|
||||
},
|
||||
],
|
||||
remote_indices: [
|
||||
{
|
||||
field_security: {
|
||||
grant: ['test-field-security-grant-1', 'test-field-security-grant-2'],
|
||||
except: ['test-field-security-except-1', 'test-field-security-except-2'],
|
||||
},
|
||||
clusters: ['test-cluster-name-1', 'test-cluster-name-2'],
|
||||
names: ['test-index-name-1', 'test-index-name-2'],
|
||||
privileges: ['test-index-privilege-1', 'test-index-privilege-2'],
|
||||
query: `{ "match": { "title": "foo" } }`,
|
||||
},
|
||||
],
|
||||
metadata: { foo: 'test-metadata' },
|
||||
run_as: ['test-run-as-1', 'test-run-as-2'],
|
||||
},
|
||||
clusters: ['test-cluster-name-1', 'test-cluster-name-2'],
|
||||
names: ['test-index-name-1', 'test-index-name-2'],
|
||||
privileges: ['test-index-privilege-1', 'test-index-privilege-2'],
|
||||
query: `{ "match": { "title": "foo" } }`,
|
||||
},
|
||||
],
|
||||
metadata: { foo: 'test-metadata' },
|
||||
run_as: ['test-run-as-1', 'test-run-as-2'],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -666,40 +656,38 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['feature_foo.foo-privilege-1', 'feature_bar.bar-privilege-1'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['feature_foo.foo-privilege-1', 'feature_bar.bar-privilege-1'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
{
|
||||
application,
|
||||
privileges: ['space_all'],
|
||||
resources: ['space:test-space-1', 'space:test-space-2'],
|
||||
},
|
||||
{
|
||||
application,
|
||||
privileges: ['feature_bar.bar-privilege-2'],
|
||||
resources: ['space:test-space-3'],
|
||||
},
|
||||
],
|
||||
cluster: ['test-cluster-privilege'],
|
||||
indices: [
|
||||
{
|
||||
field_security: {
|
||||
grant: ['test-field-security-grant-1', 'test-field-security-grant-2'],
|
||||
except: ['test-field-security-except-1', 'test-field-security-except-2'],
|
||||
},
|
||||
{
|
||||
application,
|
||||
privileges: ['space_all'],
|
||||
resources: ['space:test-space-1', 'space:test-space-2'],
|
||||
},
|
||||
{
|
||||
application,
|
||||
privileges: ['feature_bar.bar-privilege-2'],
|
||||
resources: ['space:test-space-3'],
|
||||
},
|
||||
],
|
||||
cluster: ['test-cluster-privilege'],
|
||||
indices: [
|
||||
{
|
||||
field_security: {
|
||||
grant: ['test-field-security-grant-1', 'test-field-security-grant-2'],
|
||||
except: ['test-field-security-except-1', 'test-field-security-except-2'],
|
||||
},
|
||||
names: ['test-index-name-1', 'test-index-name-2'],
|
||||
privileges: ['test-index-privilege-1', 'test-index-privilege-2'],
|
||||
query: `{ "match": { "title": "foo" } }`,
|
||||
},
|
||||
],
|
||||
remote_indices: undefined,
|
||||
metadata: { foo: 'test-metadata' },
|
||||
run_as: ['test-run-as-1', 'test-run-as-2'],
|
||||
},
|
||||
names: ['test-index-name-1', 'test-index-name-2'],
|
||||
privileges: ['test-index-privilege-1', 'test-index-privilege-2'],
|
||||
query: `{ "match": { "title": "foo" } }`,
|
||||
},
|
||||
],
|
||||
remote_indices: undefined,
|
||||
metadata: { foo: 'test-metadata' },
|
||||
run_as: ['test-run-as-1', 'test-run-as-2'],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -775,35 +763,33 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['all', 'read'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
{
|
||||
application: 'logstash-foo',
|
||||
privileges: ['logstash-privilege'],
|
||||
resources: ['logstash-resource'],
|
||||
},
|
||||
{
|
||||
application: 'beats-foo',
|
||||
privileges: ['beats-privilege'],
|
||||
resources: ['beats-resource'],
|
||||
},
|
||||
],
|
||||
cluster: ['test-cluster-privilege'],
|
||||
indices: [
|
||||
{
|
||||
names: ['test-index-name-1', 'test-index-name-2'],
|
||||
privileges: ['test-index-privilege-1', 'test-index-privilege-2'],
|
||||
},
|
||||
],
|
||||
remote_indices: undefined,
|
||||
metadata: { foo: 'test-metadata' },
|
||||
run_as: ['test-run-as-1', 'test-run-as-2'],
|
||||
},
|
||||
applications: [
|
||||
{
|
||||
application,
|
||||
privileges: ['all', 'read'],
|
||||
resources: [GLOBAL_RESOURCE],
|
||||
},
|
||||
{
|
||||
application: 'logstash-foo',
|
||||
privileges: ['logstash-privilege'],
|
||||
resources: ['logstash-resource'],
|
||||
},
|
||||
{
|
||||
application: 'beats-foo',
|
||||
privileges: ['beats-privilege'],
|
||||
resources: ['beats-resource'],
|
||||
},
|
||||
],
|
||||
cluster: ['test-cluster-privilege'],
|
||||
indices: [
|
||||
{
|
||||
names: ['test-index-name-1', 'test-index-name-2'],
|
||||
privileges: ['test-index-privilege-1', 'test-index-privilege-2'],
|
||||
},
|
||||
],
|
||||
remote_indices: undefined,
|
||||
metadata: { foo: 'test-metadata' },
|
||||
run_as: ['test-run-as-1', 'test-run-as-2'],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -835,20 +821,18 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application: 'kibana-.kibana',
|
||||
privileges: ['feature_feature_1.sub_feature_privilege_1'],
|
||||
resources: ['*'],
|
||||
},
|
||||
],
|
||||
metadata: undefined,
|
||||
},
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application: 'kibana-.kibana',
|
||||
privileges: ['feature_feature_1.sub_feature_privilege_1'],
|
||||
resources: ['*'],
|
||||
},
|
||||
],
|
||||
metadata: undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -880,20 +864,18 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application: 'kibana-.kibana',
|
||||
privileges: ['feature_feature_1.unknown_sub_feature_privilege_1'],
|
||||
resources: ['*'],
|
||||
},
|
||||
],
|
||||
metadata: undefined,
|
||||
},
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application: 'kibana-.kibana',
|
||||
privileges: ['feature_feature_1.unknown_sub_feature_privilege_1'],
|
||||
resources: ['*'],
|
||||
},
|
||||
],
|
||||
metadata: undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -925,20 +907,18 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role',
|
||||
body: {
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application: 'kibana-.kibana',
|
||||
privileges: ['feature_unknown_feature.sub_feature_privilege_1'],
|
||||
resources: ['*'],
|
||||
},
|
||||
],
|
||||
metadata: undefined,
|
||||
},
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
applications: [
|
||||
{
|
||||
application: 'kibana-.kibana',
|
||||
privileges: ['feature_unknown_feature.sub_feature_privilege_1'],
|
||||
resources: ['*'],
|
||||
},
|
||||
],
|
||||
metadata: undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -975,24 +955,22 @@ describe('PUT role', () => {
|
|||
put: [
|
||||
{
|
||||
name: 'foo-role-remote-cluster',
|
||||
body: {
|
||||
applications: [],
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
remote_cluster: [
|
||||
{
|
||||
clusters: ['cluster1', 'cluster2'],
|
||||
privileges: ['monitor_enrich'],
|
||||
},
|
||||
{
|
||||
clusters: ['cluster3', 'cluster4'],
|
||||
privileges: ['monitor_enrich'],
|
||||
},
|
||||
],
|
||||
metadata: undefined,
|
||||
},
|
||||
applications: [],
|
||||
cluster: [],
|
||||
indices: [],
|
||||
remote_indices: undefined,
|
||||
run_as: [],
|
||||
remote_cluster: [
|
||||
{
|
||||
clusters: ['cluster1', 'cluster2'],
|
||||
privileges: ['monitor_enrich'],
|
||||
},
|
||||
{
|
||||
clusters: ['cluster3', 'cluster4'],
|
||||
privileges: ['monitor_enrich'],
|
||||
},
|
||||
],
|
||||
metadata: undefined,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -113,7 +113,7 @@ export function definePutRolesRoutes({
|
|||
|
||||
await esClient.asCurrentUser.security.putRole({
|
||||
name: request.params.name,
|
||||
body,
|
||||
...body,
|
||||
});
|
||||
|
||||
if (roleGrantsSubFeaturePrivileges(features, request.body)) {
|
||||
|
|
|
@ -827,9 +827,6 @@ export class SessionIndex {
|
|||
{
|
||||
index: this.aliasName,
|
||||
keep_alive: SESSION_INDEX_CLEANUP_KEEP_ALIVE,
|
||||
// @ts-expect-error client support this option, but it is not documented and typed yet.
|
||||
// once support added we should remove this expected type error
|
||||
// https://github.com/elastic/elasticsearch-specification/issues/3144
|
||||
allow_partial_search_results: true,
|
||||
},
|
||||
{ ignore: [404], meta: true }
|
||||
|
@ -842,9 +839,6 @@ export class SessionIndex {
|
|||
{
|
||||
index: this.aliasName,
|
||||
keep_alive: SESSION_INDEX_CLEANUP_KEEP_ALIVE,
|
||||
// @ts-expect-error client support this option, but it is not documented and typed yet.
|
||||
// once support added we should remove this expected type error
|
||||
// https://github.com/elastic/elasticsearch-specification/issues/3144
|
||||
allow_partial_search_results: true,
|
||||
},
|
||||
{ meta: true }
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks';
|
||||
import type { ClusterPutComponentTemplateRequest } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { DiagnosticResult } from '@elastic/elasticsearch';
|
||||
import { errors as EsErrors } from '@elastic/elasticsearch';
|
||||
import { createOrUpdateComponentTemplate } from './create_or_update_component_template';
|
||||
|
@ -14,7 +15,7 @@ const randomDelayMultiplier = 0.01;
|
|||
const logger = loggingSystemMock.createLogger();
|
||||
const clusterClient = elasticsearchServiceMock.createClusterClient().asInternalUser;
|
||||
|
||||
const componentTemplate = {
|
||||
const componentTemplate: ClusterPutComponentTemplateRequest = {
|
||||
name: 'test-mappings',
|
||||
_meta: {
|
||||
managed: true,
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import type {
|
||||
ClusterPutComponentTemplateRequest,
|
||||
IndicesGetIndexTemplateIndexTemplateItem,
|
||||
IndicesPutIndexTemplateRequest,
|
||||
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type { Logger, ElasticsearchClient } from '@kbn/core/server';
|
||||
import { asyncForEach } from '@kbn/std';
|
||||
|
@ -52,7 +53,7 @@ const putIndexTemplateTotalFieldsLimitUsingComponentTemplate = async (
|
|||
'index.mapping.total_fields.limit': totalFieldsLimit,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as IndicesPutIndexTemplateRequest['body'],
|
||||
}),
|
||||
{ logger }
|
||||
);
|
||||
|
|
|
@ -142,9 +142,6 @@ export const createThreatSignals = async ({
|
|||
await services.scopedClusterClient.asCurrentUser.openPointInTime({
|
||||
index: threatIndex,
|
||||
keep_alive: THREAT_PIT_KEEP_ALIVE,
|
||||
// @ts-expect-error client support this option, but it is not documented and typed yet, but we need this fix in 8.16.2.
|
||||
// once support added we should remove this expected type error
|
||||
// https://github.com/elastic/elasticsearch-specification/issues/3144
|
||||
allow_partial_search_results: true,
|
||||
})
|
||||
).id;
|
||||
|
|
|
@ -22,15 +22,13 @@ export async function addIntegrationToLogIndexTemplate({
|
|||
|
||||
await esClient.indices.putIndexTemplate({
|
||||
name: 'logs',
|
||||
body: {
|
||||
...indexTemplates[0].index_template,
|
||||
_meta: {
|
||||
...indexTemplates[0].index_template._meta,
|
||||
package: {
|
||||
name,
|
||||
},
|
||||
managed_by: managedBy,
|
||||
...indexTemplates[0].index_template,
|
||||
_meta: {
|
||||
...indexTemplates[0].index_template._meta,
|
||||
package: {
|
||||
name,
|
||||
},
|
||||
managed_by: managedBy,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -42,13 +40,11 @@ export async function cleanLogIndexTemplate({ esClient }: { esClient: Client })
|
|||
|
||||
await esClient.indices.putIndexTemplate({
|
||||
name: 'logs',
|
||||
body: {
|
||||
...indexTemplates[0].index_template,
|
||||
_meta: {
|
||||
...indexTemplates[0].index_template._meta,
|
||||
package: undefined,
|
||||
managed_by: undefined,
|
||||
},
|
||||
...indexTemplates[0].index_template,
|
||||
_meta: {
|
||||
...indexTemplates[0].index_template._meta,
|
||||
package: undefined,
|
||||
managed_by: undefined,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2304,10 +2304,10 @@
|
|||
"@elastic/transport" "^8.3.1"
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@elastic/elasticsearch@^8.16.0":
|
||||
version "8.16.0"
|
||||
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-8.16.0.tgz#35c6729e15684154b8b3c391cfad34877d771cf0"
|
||||
integrity sha512-uiPC6AePESl/jakx+ZLarLsLdxDHiCSrpAkkXJ5Q8A78vadEQsTGXRUVFwWWkS8gfGthnT3O+QK6BHXuszd0KQ==
|
||||
"@elastic/elasticsearch@^8.17.0":
|
||||
version "8.17.0"
|
||||
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-8.17.0.tgz#0214265bc04a3fe0d23a410b8d08b28217aac540"
|
||||
integrity sha512-FZ+gQUrPsMpQ2RRIXwTmCoUeFCEausMhp4eQOyxT9j1cwGXHJrhelR6jffM1SC95kQUkB7+TcTq7oQ+bG2BQ9g==
|
||||
dependencies:
|
||||
"@elastic/transport" "^8.9.1"
|
||||
apache-arrow "^18.0.0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue