mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Alerting] Prevent our plugins from being disabled (#113461)
* No more disable * Fix types * Add event log and docker * Fix test * Remove unnecessary method * Fix types, again Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
4f85f5e841
commit
3f4240bdf1
36 changed files with 10 additions and 299 deletions
|
@ -31,11 +31,6 @@ Be sure to back up the encryption key value somewhere safe, as your alerting rul
|
|||
[[action-settings]]
|
||||
==== Action settings
|
||||
|
||||
`xpack.actions.enabled`::
|
||||
deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
|
||||
Feature toggle that enables Actions in {kib}.
|
||||
If `false`, all features dependent on Actions are disabled, including the *Observability* and *Security* apps. Default: `true`.
|
||||
|
||||
`xpack.actions.allowedHosts` {ess-icon}::
|
||||
A list of hostnames that {kib} is allowed to connect to when built-in actions are triggered. It defaults to `[*]`, allowing any host, but keep in mind the potential for SSRF attacks when hosts are not explicitly added to the allowed hosts. An empty list `[]` can be used to block built-in actions from making any external connections.
|
||||
+
|
||||
|
|
|
@ -194,7 +194,6 @@ kibana_vars=(
|
|||
vis_type_vega.enableExternalUrls
|
||||
xpack.actions.allowedHosts
|
||||
xpack.actions.customHostSettings
|
||||
xpack.actions.enabled
|
||||
xpack.actions.enabledActionTypes
|
||||
xpack.actions.maxResponseContentLength
|
||||
xpack.actions.preconfigured
|
||||
|
@ -252,7 +251,6 @@ kibana_vars=(
|
|||
xpack.discoverEnhanced.actions.exploreDataInContextMenu.enabled
|
||||
xpack.encryptedSavedObjects.encryptionKey
|
||||
xpack.encryptedSavedObjects.keyRotation.decryptionOnlyKeys
|
||||
xpack.event_log.enabled
|
||||
xpack.event_log.indexEntries
|
||||
xpack.event_log.logEntries
|
||||
xpack.fleet.agentPolicies
|
||||
|
@ -384,7 +382,6 @@ kibana_vars=(
|
|||
xpack.securitySolution.prebuiltRulesFromSavedObjects
|
||||
xpack.spaces.enabled
|
||||
xpack.spaces.maxSpaces
|
||||
xpack.task_manager.enabled
|
||||
xpack.task_manager.index
|
||||
xpack.task_manager.max_attempts
|
||||
xpack.task_manager.max_poll_inactivity_cycles
|
||||
|
|
|
@ -439,7 +439,6 @@ describe('create()', () => {
|
|||
|
||||
test('throws error creating action with disabled actionType', async () => {
|
||||
const localConfigUtils = getActionsConfigurationUtilities({
|
||||
enabled: true,
|
||||
enabledActionTypes: ['some-not-ignored-action-type'],
|
||||
allowedHosts: ['*'],
|
||||
preconfiguredAlertHistoryEsIndex: false,
|
||||
|
|
|
@ -22,7 +22,6 @@ import moment from 'moment';
|
|||
const mockLogger = loggingSystemMock.create().get() as jest.Mocked<Logger>;
|
||||
|
||||
const defaultActionsConfig: ActionsConfig = {
|
||||
enabled: false,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: [],
|
||||
preconfiguredAlertHistoryEsIndex: false,
|
||||
|
@ -47,7 +46,6 @@ describe('ensureUriAllowed', () => {
|
|||
test('returns true when "any" hostnames are allowed', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [AllowedHosts.Any],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -77,7 +75,6 @@ describe('ensureUriAllowed', () => {
|
|||
test('returns true when the hostname in the requested uri is in the allowedHosts', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: ['github.com'],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -91,7 +88,6 @@ describe('ensureHostnameAllowed', () => {
|
|||
test('returns true when "any" hostnames are allowed', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [AllowedHosts.Any],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -112,7 +108,6 @@ describe('ensureHostnameAllowed', () => {
|
|||
test('returns true when the hostname in the requested uri is in the allowedHosts', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: ['github.com'],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -126,7 +121,6 @@ describe('isUriAllowed', () => {
|
|||
test('returns true when "any" hostnames are allowed', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [AllowedHosts.Any],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -152,7 +146,6 @@ describe('isUriAllowed', () => {
|
|||
test('returns true when the hostname in the requested uri is in the allowedHosts', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: ['github.com'],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -166,7 +159,6 @@ describe('isHostnameAllowed', () => {
|
|||
test('returns true when "any" hostnames are allowed', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [AllowedHosts.Any],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -181,7 +173,6 @@ describe('isHostnameAllowed', () => {
|
|||
test('returns true when the hostname in the requested uri is in the allowedHosts', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: ['github.com'],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -193,7 +184,6 @@ describe('isActionTypeEnabled', () => {
|
|||
test('returns true when "any" actionTypes are allowed', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: ['ignore', EnabledActionTypes.Any],
|
||||
};
|
||||
|
@ -203,7 +193,6 @@ describe('isActionTypeEnabled', () => {
|
|||
test('returns false when no actionType is allowed', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: [],
|
||||
};
|
||||
|
@ -213,7 +202,6 @@ describe('isActionTypeEnabled', () => {
|
|||
test('returns false when the actionType is not in the enabled list', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: ['foo'],
|
||||
};
|
||||
|
@ -223,7 +211,6 @@ describe('isActionTypeEnabled', () => {
|
|||
test('returns true when the actionType is in the enabled list', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: ['ignore', 'foo'],
|
||||
};
|
||||
|
@ -235,7 +222,6 @@ describe('ensureActionTypeEnabled', () => {
|
|||
test('does not throw when any actionType is allowed', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: ['ignore', EnabledActionTypes.Any],
|
||||
};
|
||||
|
@ -254,7 +240,6 @@ describe('ensureActionTypeEnabled', () => {
|
|||
test('throws when actionType is not enabled', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: ['ignore'],
|
||||
};
|
||||
|
@ -268,7 +253,6 @@ describe('ensureActionTypeEnabled', () => {
|
|||
test('does not throw when actionType is enabled', () => {
|
||||
const config: ActionsConfig = {
|
||||
...defaultActionsConfig,
|
||||
enabled: false,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: ['ignore', 'foo'],
|
||||
};
|
||||
|
|
|
@ -247,7 +247,6 @@ async function createServer(useHttps: boolean = false): Promise<CreateServerResu
|
|||
}
|
||||
|
||||
const BaseActionsConfig: ActionsConfig = {
|
||||
enabled: true,
|
||||
allowedHosts: ['*'],
|
||||
enabledActionTypes: ['*'],
|
||||
preconfiguredAlertHistoryEsIndex: false,
|
||||
|
|
|
@ -29,7 +29,6 @@ describe('config validation', () => {
|
|||
"idleInterval": "PT1H",
|
||||
"pageSize": 100,
|
||||
},
|
||||
"enabled": true,
|
||||
"enabledActionTypes": Array [
|
||||
"*",
|
||||
],
|
||||
|
@ -70,7 +69,6 @@ describe('config validation', () => {
|
|||
"idleInterval": "PT1H",
|
||||
"pageSize": 100,
|
||||
},
|
||||
"enabled": true,
|
||||
"enabledActionTypes": Array [
|
||||
"*",
|
||||
],
|
||||
|
@ -196,7 +194,6 @@ describe('config validation', () => {
|
|||
"idleInterval": "PT1H",
|
||||
"pageSize": 100,
|
||||
},
|
||||
"enabled": true,
|
||||
"enabledActionTypes": Array [
|
||||
"*",
|
||||
],
|
||||
|
|
|
@ -57,7 +57,6 @@ const customHostSettingsSchema = schema.object({
|
|||
export type CustomHostSettings = TypeOf<typeof customHostSettingsSchema>;
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
allowedHosts: schema.arrayOf(
|
||||
schema.oneOf([schema.string({ hostname: true }), schema.literal(AllowedHosts.Any)]),
|
||||
{
|
||||
|
|
|
@ -1,44 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { config } from './index';
|
||||
import { applyDeprecations, configDeprecationFactory } from '@kbn/config';
|
||||
|
||||
const CONFIG_PATH = 'xpack.actions';
|
||||
const applyStackAlertDeprecations = (settings: Record<string, unknown> = {}) => {
|
||||
const deprecations = config.deprecations!(configDeprecationFactory);
|
||||
const deprecationMessages: string[] = [];
|
||||
const _config = {
|
||||
[CONFIG_PATH]: settings,
|
||||
};
|
||||
const { config: migrated } = applyDeprecations(
|
||||
_config,
|
||||
deprecations.map((deprecation) => ({
|
||||
deprecation,
|
||||
path: CONFIG_PATH,
|
||||
})),
|
||||
() =>
|
||||
({ message }) =>
|
||||
deprecationMessages.push(message)
|
||||
);
|
||||
return {
|
||||
messages: deprecationMessages,
|
||||
migrated,
|
||||
};
|
||||
};
|
||||
|
||||
describe('index', () => {
|
||||
describe('deprecations', () => {
|
||||
it('should deprecate .enabled flag', () => {
|
||||
const { messages } = applyStackAlertDeprecations({ enabled: false });
|
||||
expect(messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"\\"xpack.actions.enabled\\" is deprecated. The ability to disable this plugin will be removed in 8.0.0.",
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -122,16 +122,5 @@ export const config: PluginConfigDescriptor<ActionsConfig> = {
|
|||
});
|
||||
}
|
||||
},
|
||||
(settings, fromPath, addDeprecation) => {
|
||||
const actions = get(settings, fromPath);
|
||||
if (actions?.enabled === false || actions?.enabled === true) {
|
||||
addDeprecation({
|
||||
message: `"xpack.actions.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
|
||||
correctiveActions: {
|
||||
manualSteps: [`Remove "xpack.actions.enabled" from your kibana configs.`],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -65,7 +65,6 @@ describe('custom_host_settings', () => {
|
|||
|
||||
describe('resolveCustomHosts()', () => {
|
||||
const defaultActionsConfig: ActionsConfig = {
|
||||
enabled: true,
|
||||
allowedHosts: [],
|
||||
enabledActionTypes: [],
|
||||
preconfiguredAlertHistoryEsIndex: false,
|
||||
|
|
|
@ -34,7 +34,6 @@ describe('Actions Plugin', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
context = coreMock.createPluginInitializerContext<ActionsConfig>({
|
||||
enabled: true,
|
||||
enabledActionTypes: ['*'],
|
||||
allowedHosts: ['*'],
|
||||
preconfiguredAlertHistoryEsIndex: false,
|
||||
|
@ -253,7 +252,6 @@ describe('Actions Plugin', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
context = coreMock.createPluginInitializerContext<ActionsConfig>({
|
||||
enabled: true,
|
||||
enabledActionTypes: ['*'],
|
||||
allowedHosts: ['*'],
|
||||
preconfiguredAlertHistoryEsIndex: false,
|
||||
|
|
|
@ -1,44 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { config } from './index';
|
||||
import { applyDeprecations, configDeprecationFactory } from '@kbn/config';
|
||||
|
||||
const CONFIG_PATH = 'xpack.alerting';
|
||||
const applyStackAlertDeprecations = (settings: Record<string, unknown> = {}) => {
|
||||
const deprecations = config.deprecations!(configDeprecationFactory);
|
||||
const deprecationMessages: string[] = [];
|
||||
const _config = {
|
||||
[CONFIG_PATH]: settings,
|
||||
};
|
||||
const { config: migrated } = applyDeprecations(
|
||||
_config,
|
||||
deprecations.map((deprecation) => ({
|
||||
deprecation,
|
||||
path: CONFIG_PATH,
|
||||
})),
|
||||
() =>
|
||||
({ message }) =>
|
||||
deprecationMessages.push(message)
|
||||
);
|
||||
return {
|
||||
messages: deprecationMessages,
|
||||
migrated,
|
||||
};
|
||||
};
|
||||
|
||||
describe('index', () => {
|
||||
describe('deprecations', () => {
|
||||
it('should deprecate .enabled flag', () => {
|
||||
const { messages } = applyStackAlertDeprecations({ enabled: false });
|
||||
expect(messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"\\"xpack.alerting.enabled\\" is deprecated. The ability to disable this plugin will be removed in 8.0.0.",
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,7 +4,6 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { get } from 'lodash';
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { RulesClient as RulesClientClass } from './rules_client';
|
||||
import { PluginConfigDescriptor, PluginInitializerContext } from '../../../../src/core/server';
|
||||
|
@ -58,16 +57,5 @@ export const config: PluginConfigDescriptor<AlertsConfigType> = {
|
|||
'xpack.alerts.invalidateApiKeysTask.removalDelay',
|
||||
'xpack.alerting.invalidateApiKeysTask.removalDelay'
|
||||
),
|
||||
(settings, fromPath, addDeprecation) => {
|
||||
const alerting = get(settings, fromPath);
|
||||
if (alerting?.enabled === false || alerting?.enabled === true) {
|
||||
addDeprecation({
|
||||
message: `"xpack.alerting.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
|
||||
correctiveActions: {
|
||||
manualSteps: [`Remove "xpack.alerting.enabled" from your kibana configs.`],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -10,7 +10,6 @@ import { eventLoggerMock } from './event_logger.mock';
|
|||
|
||||
const createEventLogServiceMock = () => {
|
||||
const mock: jest.Mocked<IEventLogService> = {
|
||||
isEnabled: jest.fn(),
|
||||
isLoggingEntries: jest.fn(),
|
||||
isIndexingEntries: jest.fn(),
|
||||
registerProviderActions: jest.fn(),
|
||||
|
|
|
@ -19,14 +19,13 @@ describe('EventLogService', () => {
|
|||
const esContext = contextMock.create();
|
||||
|
||||
function getService(config: IEventLogConfig) {
|
||||
const { enabled, logEntries, indexEntries } = config;
|
||||
const { logEntries, indexEntries } = config;
|
||||
return new EventLogService({
|
||||
esContext,
|
||||
systemLogger,
|
||||
kibanaUUID: '42',
|
||||
savedObjectProviderRegistry,
|
||||
config: {
|
||||
enabled,
|
||||
logEntries,
|
||||
indexEntries,
|
||||
},
|
||||
|
@ -37,30 +36,19 @@ describe('EventLogService', () => {
|
|||
test('returns config values from service methods', () => {
|
||||
let service;
|
||||
|
||||
service = getService({ enabled: true, logEntries: true, indexEntries: true });
|
||||
expect(service.isEnabled()).toEqual(true);
|
||||
service = getService({ logEntries: true, indexEntries: true });
|
||||
expect(service.isLoggingEntries()).toEqual(true);
|
||||
expect(service.isIndexingEntries()).toEqual(true);
|
||||
|
||||
service = getService({ enabled: true, logEntries: false, indexEntries: true });
|
||||
expect(service.isEnabled()).toEqual(true);
|
||||
service = getService({ logEntries: false, indexEntries: true });
|
||||
expect(service.isLoggingEntries()).toEqual(false);
|
||||
expect(service.isIndexingEntries()).toEqual(true);
|
||||
|
||||
service = getService({ enabled: true, logEntries: true, indexEntries: false });
|
||||
expect(service.isEnabled()).toEqual(true);
|
||||
service = getService({ logEntries: true, indexEntries: false });
|
||||
expect(service.isLoggingEntries()).toEqual(true);
|
||||
expect(service.isIndexingEntries()).toEqual(false);
|
||||
|
||||
service = getService({ enabled: true, logEntries: false, indexEntries: false });
|
||||
expect(service.isEnabled()).toEqual(true);
|
||||
expect(service.isLoggingEntries()).toEqual(false);
|
||||
expect(service.isIndexingEntries()).toEqual(false);
|
||||
|
||||
// this is the only non-obvious one; when enabled is false,
|
||||
// logging/indexing will be false as well.
|
||||
service = getService({ enabled: false, logEntries: true, indexEntries: true });
|
||||
expect(service.isEnabled()).toEqual(false);
|
||||
service = getService({ logEntries: false, indexEntries: false });
|
||||
expect(service.isLoggingEntries()).toEqual(false);
|
||||
expect(service.isIndexingEntries()).toEqual(false);
|
||||
});
|
||||
|
|
|
@ -55,16 +55,12 @@ export class EventLogService implements IEventLogService {
|
|||
this.kibanaVersion = kibanaVersion;
|
||||
}
|
||||
|
||||
public isEnabled(): boolean {
|
||||
return this.config.enabled;
|
||||
}
|
||||
|
||||
public isLoggingEntries(): boolean {
|
||||
return this.isEnabled() && this.config.logEntries;
|
||||
return this.config.logEntries;
|
||||
}
|
||||
|
||||
public isIndexingEntries(): boolean {
|
||||
return this.isEnabled() && this.config.indexEntries;
|
||||
return this.config.indexEntries;
|
||||
}
|
||||
|
||||
registerProviderActions(provider: string, actions: string[]): void {
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('EventLogger', () => {
|
|||
service = new EventLogService({
|
||||
esContext,
|
||||
systemLogger,
|
||||
config: { enabled: true, logEntries: true, indexEntries: true },
|
||||
config: { logEntries: true, indexEntries: true },
|
||||
kibanaUUID: KIBANA_SERVER_UUID,
|
||||
savedObjectProviderRegistry: savedObjectProviderRegistryMock.create(),
|
||||
kibanaVersion: '1.0.1',
|
||||
|
|
|
@ -66,8 +66,6 @@ export class EventLogger implements IEventLogger {
|
|||
|
||||
// non-blocking, but spawns an async task to do the work
|
||||
logEvent(eventProperties: IEvent): void {
|
||||
if (!this.eventLogService.isEnabled()) return;
|
||||
|
||||
const event: IEvent = {};
|
||||
const fixedProperties = {
|
||||
ecs: {
|
||||
|
|
|
@ -26,20 +26,5 @@ export { createReadySignal } from './lib/ready_signal';
|
|||
|
||||
export const config: PluginConfigDescriptor<IEventLogConfig> = {
|
||||
schema: ConfigSchema,
|
||||
deprecations: () => [
|
||||
(settings, fromPath, addDeprecation) => {
|
||||
if (
|
||||
settings?.xpack?.eventLog?.enabled === false ||
|
||||
settings?.xpack?.eventLog?.enabled === true
|
||||
) {
|
||||
addDeprecation({
|
||||
message: `"xpack.eventLog.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
|
||||
correctiveActions: {
|
||||
manualSteps: [`Remove "xpack.eventLog.enabled" from your kibana configs.`],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
export const plugin = (context: PluginInitializerContext) => new Plugin(context);
|
||||
|
|
|
@ -21,7 +21,6 @@ describe('event_log plugin', () => {
|
|||
const setup = plugin.setup(coreSetup);
|
||||
expect(typeof setup.getLogger).toBe('function');
|
||||
expect(typeof setup.getProviderActions).toBe('function');
|
||||
expect(typeof setup.isEnabled).toBe('function');
|
||||
expect(typeof setup.isIndexingEntries).toBe('function');
|
||||
expect(typeof setup.isLoggingEntries).toBe('function');
|
||||
expect(typeof setup.isProviderActionRegistered).toBe('function');
|
||||
|
|
|
@ -18,7 +18,6 @@ import { SavedObjectProvider } from './saved_object_provider_registry';
|
|||
export const SAVED_OBJECT_REL_PRIMARY = 'primary';
|
||||
|
||||
export const ConfigSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
logEntries: schema.boolean({ defaultValue: false }),
|
||||
indexEntries: schema.boolean({ defaultValue: true }),
|
||||
});
|
||||
|
@ -27,7 +26,6 @@ export type IEventLogConfig = TypeOf<typeof ConfigSchema>;
|
|||
|
||||
// the object exposed by plugin.setup()
|
||||
export interface IEventLogService {
|
||||
isEnabled(): boolean;
|
||||
isLoggingEntries(): boolean;
|
||||
isIndexingEntries(): boolean;
|
||||
registerProviderActions(provider: string, actions: string[]): void;
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
});
|
||||
export const configSchema = schema.object({});
|
||||
|
||||
export type Config = TypeOf<typeof configSchema>;
|
||||
|
|
|
@ -12,7 +12,6 @@ describe('config validation', () => {
|
|||
const config: Record<string, unknown> = {};
|
||||
expect(configSchema.validate(config)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"enabled": true,
|
||||
"ephemeral_tasks": Object {
|
||||
"enabled": false,
|
||||
"request_capacity": 10,
|
||||
|
@ -71,7 +70,6 @@ describe('config validation', () => {
|
|||
const config: Record<string, unknown> = {};
|
||||
expect(configSchema.validate(config)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"enabled": true,
|
||||
"ephemeral_tasks": Object {
|
||||
"enabled": false,
|
||||
"request_capacity": 10,
|
||||
|
@ -117,7 +115,6 @@ describe('config validation', () => {
|
|||
};
|
||||
expect(configSchema.validate(config)).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"enabled": true,
|
||||
"ephemeral_tasks": Object {
|
||||
"enabled": false,
|
||||
"request_capacity": 10,
|
||||
|
|
|
@ -43,7 +43,6 @@ export const taskExecutionFailureThresholdSchema = schema.object(
|
|||
|
||||
export const configSchema = schema.object(
|
||||
{
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
/* The maximum number of times a task will be attempted before being abandoned as failed */
|
||||
max_attempts: schema.number({
|
||||
defaultValue: 3,
|
||||
|
|
|
@ -42,7 +42,6 @@ describe('EphemeralTaskLifecycle', () => {
|
|||
definitions: new TaskTypeDictionary(taskManagerLogger),
|
||||
executionContext,
|
||||
config: {
|
||||
enabled: true,
|
||||
max_workers: 10,
|
||||
index: 'foo',
|
||||
max_attempts: 9,
|
||||
|
|
|
@ -52,13 +52,4 @@ describe('deprecations', () => {
|
|||
]
|
||||
`);
|
||||
});
|
||||
|
||||
it('logs a deprecation warning for the enabled config', () => {
|
||||
const { messages } = applyTaskManagerDeprecations({ enabled: true });
|
||||
expect(messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"\\"xpack.task_manager.enabled\\" is deprecated. The ability to disable this plugin will be removed in 8.0.0.",
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -68,16 +68,5 @@ export const config: PluginConfigDescriptor<TaskManagerConfig> = {
|
|||
});
|
||||
}
|
||||
},
|
||||
(settings, fromPath, addDeprecation) => {
|
||||
const taskManager = get(settings, fromPath);
|
||||
if (taskManager?.enabled === false || taskManager?.enabled === true) {
|
||||
addDeprecation({
|
||||
message: `"xpack.task_manager.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
|
||||
correctiveActions: {
|
||||
manualSteps: [`Remove "xpack.task_manager.enabled" from your kibana configs.`],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -29,7 +29,6 @@ describe('managed configuration', () => {
|
|||
clock = sinon.useFakeTimers();
|
||||
|
||||
const context = coreMock.createPluginInitializerContext<TaskManagerConfig>({
|
||||
enabled: true,
|
||||
max_workers: 10,
|
||||
index: 'foo',
|
||||
max_attempts: 9,
|
||||
|
|
|
@ -13,7 +13,6 @@ import { TaskManagerConfig } from '../config';
|
|||
describe('Configuration Statistics Aggregator', () => {
|
||||
test('merges the static config with the merged configs', async () => {
|
||||
const configuration: TaskManagerConfig = {
|
||||
enabled: true,
|
||||
max_workers: 10,
|
||||
index: 'foo',
|
||||
max_attempts: 9,
|
||||
|
|
|
@ -17,7 +17,6 @@ beforeEach(() => {
|
|||
|
||||
describe('createMonitoringStatsStream', () => {
|
||||
const configuration: TaskManagerConfig = {
|
||||
enabled: true,
|
||||
max_workers: 10,
|
||||
index: 'foo',
|
||||
max_attempts: 9,
|
||||
|
|
|
@ -16,7 +16,6 @@ describe('TaskManagerPlugin', () => {
|
|||
describe('setup', () => {
|
||||
test('throws if no valid UUID is available', async () => {
|
||||
const pluginInitializerContext = coreMock.createPluginInitializerContext<TaskManagerConfig>({
|
||||
enabled: true,
|
||||
max_workers: 10,
|
||||
index: 'foo',
|
||||
max_attempts: 9,
|
||||
|
@ -59,7 +58,6 @@ describe('TaskManagerPlugin', () => {
|
|||
|
||||
test('throws if setup methods are called after start', async () => {
|
||||
const pluginInitializerContext = coreMock.createPluginInitializerContext<TaskManagerConfig>({
|
||||
enabled: true,
|
||||
max_workers: 10,
|
||||
index: 'foo',
|
||||
max_attempts: 9,
|
||||
|
@ -131,7 +129,6 @@ describe('TaskManagerPlugin', () => {
|
|||
|
||||
test('it logs a warning when the unsafe `exclude_task_types` config is used', async () => {
|
||||
const pluginInitializerContext = coreMock.createPluginInitializerContext<TaskManagerConfig>({
|
||||
enabled: true,
|
||||
max_workers: 10,
|
||||
index: 'foo',
|
||||
max_attempts: 9,
|
||||
|
|
|
@ -1,44 +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
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { config } from './index';
|
||||
import { applyDeprecations, configDeprecationFactory } from '@kbn/config';
|
||||
|
||||
const CONFIG_PATH = 'xpack.trigger_actions_ui';
|
||||
const applyStackAlertDeprecations = (settings: Record<string, unknown> = {}) => {
|
||||
const deprecations = config.deprecations!(configDeprecationFactory);
|
||||
const deprecationMessages: string[] = [];
|
||||
const _config = {
|
||||
[CONFIG_PATH]: settings,
|
||||
};
|
||||
const { config: migrated } = applyDeprecations(
|
||||
_config,
|
||||
deprecations.map((deprecation) => ({
|
||||
deprecation,
|
||||
path: CONFIG_PATH,
|
||||
})),
|
||||
() =>
|
||||
({ message }) =>
|
||||
deprecationMessages.push(message)
|
||||
);
|
||||
return {
|
||||
messages: deprecationMessages,
|
||||
migrated,
|
||||
};
|
||||
};
|
||||
|
||||
describe('index', () => {
|
||||
describe('deprecations', () => {
|
||||
it('should deprecate .enabled flag', () => {
|
||||
const { messages } = applyStackAlertDeprecations({ enabled: false });
|
||||
expect(messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"\\"xpack.trigger_actions_ui.enabled\\" is deprecated. The ability to disable this plugin will be removed in 8.0.0.",
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -4,7 +4,6 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { get } from 'lodash';
|
||||
import { PluginConfigDescriptor, PluginInitializerContext } from 'kibana/server';
|
||||
import { configSchema, ConfigSchema } from '../config';
|
||||
import { TriggersActionsPlugin } from './plugin';
|
||||
|
@ -26,19 +25,6 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
|
|||
enableGeoTrackingThresholdAlert: true,
|
||||
},
|
||||
schema: configSchema,
|
||||
deprecations: () => [
|
||||
(settings, fromPath, addDeprecation) => {
|
||||
const triggersActionsUi = get(settings, fromPath);
|
||||
if (triggersActionsUi?.enabled === false || triggersActionsUi?.enabled === true) {
|
||||
addDeprecation({
|
||||
message: `"xpack.trigger_actions_ui.enabled" is deprecated. The ability to disable this plugin will be removed in 8.0.0.`,
|
||||
correctiveActions: {
|
||||
manualSteps: [`Remove "xpack.trigger_actions_ui.enabled" from your kibana configs.`],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const plugin = (ctx: PluginInitializerContext) => new TriggersActionsPlugin(ctx);
|
||||
|
|
|
@ -38,7 +38,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
|||
...integrationConfig.get('kbnTestServer'),
|
||||
serverArgs: [
|
||||
...integrationConfig.get('kbnTestServer.serverArgs'),
|
||||
'--xpack.eventLog.enabled=true',
|
||||
'--xpack.eventLog.logEntries=true',
|
||||
'--xpack.eventLog.indexEntries=true',
|
||||
'--xpack.task_manager.monitored_aggregated_stats_refresh_rate=5000',
|
||||
|
|
|
@ -179,7 +179,7 @@ export const isEventLogServiceEnabledRoute = (
|
|||
res: KibanaResponseFactory
|
||||
): Promise<IKibanaResponse<any>> {
|
||||
logger.info(`test if event logger is enabled`);
|
||||
return res.ok({ body: { isEnabled: eventLogService.isEnabled() } });
|
||||
return res.ok({ body: { isEnabled: true } });
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
|
@ -19,14 +19,6 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
const retry = getService('retry');
|
||||
|
||||
describe('Event Log service API', () => {
|
||||
it('should check if it is enabled', async () => {
|
||||
const configValue = config
|
||||
.get('kbnTestServer.serverArgs')
|
||||
.find((val: string) => val === '--xpack.eventLog.enabled=true');
|
||||
const result = await isEventLogServiceEnabled();
|
||||
expect(configValue).to.be.eql(`--xpack.eventLog.enabled=${result.body.isEnabled}`);
|
||||
});
|
||||
|
||||
it('should check if logging entries is enabled', async () => {
|
||||
const configValue = config
|
||||
.get('kbnTestServer.serverArgs')
|
||||
|
@ -216,14 +208,6 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
.expect(200);
|
||||
}
|
||||
|
||||
async function isEventLogServiceEnabled() {
|
||||
log.debug(`isEventLogServiceEnabled`);
|
||||
return await supertest
|
||||
.get(`/api/log_event_fixture/isEventLogServiceEnabled`)
|
||||
.set('kbn-xsrf', 'foo')
|
||||
.expect(200);
|
||||
}
|
||||
|
||||
async function isEventLogServiceLoggingEntries() {
|
||||
log.debug(`isEventLogServiceLoggingEntries`);
|
||||
return await supertest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue