Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Expand scope of xpack.security.enabled deprecation warning #111676

Merged
merged 6 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions x-pack/plugins/security/server/config_deprecations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,12 @@ describe('Config Deprecations', () => {
expect(migrated).toEqual(config);
expect(messages).toMatchInlineSnapshot(`
Array [
"Disabling the security plugin \\"xpack.security.enabled\\" will only be supported by disable security in Elasticsearch.",
"Enabling or disabling the Security plugin in Kibana is deprecated. Configure security in Elasticsearch instead.",
]
`);
});

it('does not warn when the security plugin is enabled', () => {
it('warns when the security plugin is enabled', () => {
const config = {
xpack: {
security: {
Expand All @@ -407,6 +407,23 @@ describe('Config Deprecations', () => {
};
const { messages, migrated } = applyConfigDeprecations(cloneDeep(config));
expect(migrated).toEqual(config);
expect(messages).toMatchInlineSnapshot(`
Array [
"Enabling or disabling the Security plugin in Kibana is deprecated. Configure security in Elasticsearch instead.",
]
`);
});

it("does not warn when xpack.security.enabled isn't set", () => {
const config = {
xpack: {
security: {
session: { idleTimeout: 123, lifespan: 345 },
},
},
};
const { messages, migrated } = applyConfigDeprecations(cloneDeep(config));
expect(migrated).toEqual(config);
expect(messages).toHaveLength(0);
});
});
13 changes: 8 additions & 5 deletions x-pack/plugins/security/server/config_deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,25 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
}
},
(settings, fromPath, addDeprecation) => {
if (settings?.xpack?.security?.enabled === false) {
if ('enabled' in (settings?.xpack?.security || {})) {
addDeprecation({
title: i18n.translate('xpack.security.deprecations.enabledTitle', {
defaultMessage: 'Disabling the security plugin "xpack.security.enabled" is deprecated',
defaultMessage: 'Setting "xpack.security.enabled" is deprecated',
}),
message: i18n.translate('xpack.security.deprecations.enabledMessage', {
defaultMessage:
'Disabling the security plugin "xpack.security.enabled" will only be supported by disable security in Elasticsearch.',
'Enabling or disabling the Security plugin in Kibana is deprecated. Configure security in Elasticsearch instead.',
}),
documentationUrl:
'https://www.elastic.co/guide/en/elasticsearch/reference/current/secure-cluster.html',
correctiveActions: {
manualSteps: [
i18n.translate('xpack.security.deprecations.enabled.manualStepOneMessage', {
defaultMessage: `Remove "xpack.security.enabled" from your Kibana configuration.`,
defaultMessage: 'Remove "xpack.security.enabled" from kibana.yml.',
}),
i18n.translate('xpack.security.deprecations.enabled.manualStepTwoMessage', {
defaultMessage: `To turn off security features, disable them in Elasticsearch instead.`,
defaultMessage:
'Set "xpack.security.enabled" to true or false in elasticsearch.yml to enable or disable security.',
}),
],
},
Expand Down