Skip to content

Commit

Permalink
[7.x] Improve xpack.security.session deprecation warnings (#111531)
Browse files Browse the repository at this point in the history
Improve copy and set level to `warning` instead of `critical`.

Co-authored-by: debadair <debadair@elastic.co>
  • Loading branch information
watson and debadair authored Sep 10, 2021
1 parent 2528898 commit d389bf5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
10 changes: 5 additions & 5 deletions x-pack/plugins/security/server/config_deprecations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe('Config Deprecations', () => {
expect(migrated).toEqual(defaultConfig);
expect(messages).toMatchInlineSnapshot(`
Array [
"Session idle timeout (\\"xpack.security.session.idleTimeout\\") will be set to 1 hour by default in the next major version (8.0).",
"Session lifespan (\\"xpack.security.session.lifespan\\") will be set to 30 days by default in the next major version (8.0).",
"The session idle timeout will default to 1 hour in 8.0.",
"The session lifespan will default to 30 days in 8.0.",
]
`);
});
Expand All @@ -54,7 +54,7 @@ describe('Config Deprecations', () => {
expect(migrated).toEqual(defaultConfig);
expect(messages).toMatchInlineSnapshot(`
Array [
"Session idle timeout (\\"xpack.security.session.idleTimeout\\") will be set to 1 hour by default in the next major version (8.0).",
"The session idle timeout will default to 1 hour in 8.0.",
]
`);
});
Expand All @@ -65,7 +65,7 @@ describe('Config Deprecations', () => {
expect(migrated).toEqual(defaultConfig);
expect(messages).toMatchInlineSnapshot(`
Array [
"Session lifespan (\\"xpack.security.session.lifespan\\") will be set to 30 days by default in the next major version (8.0).",
"The session lifespan will default to 30 days in 8.0.",
]
`);
});
Expand All @@ -84,7 +84,7 @@ describe('Config Deprecations', () => {
expect(messages).toMatchInlineSnapshot(`
Array [
"Setting \\"xpack.security.sessionTimeout\\" has been replaced by \\"xpack.security.session.idleTimeout\\"",
"Session lifespan (\\"xpack.security.session.lifespan\\") will be set to 30 days by default in the next major version (8.0).",
"The session lifespan will default to 30 days in 8.0.",
]
`);
});
Expand Down
34 changes: 26 additions & 8 deletions x-pack/plugins/security/server/config_deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,47 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
(settings, fromPath, addDeprecation) => {
if (settings?.xpack?.security?.session?.idleTimeout === undefined) {
addDeprecation({
message:
'Session idle timeout ("xpack.security.session.idleTimeout") will be set to 1 hour by default in the next major version (8.0).',
level: 'warning',
title: i18n.translate('xpack.security.deprecations.idleTimeoutTitle', {
defaultMessage: 'The "xpack.security.session.idleTimeout" default is changing',
}),
message: i18n.translate('xpack.security.deprecations.idleTimeoutMessage', {
defaultMessage: 'The session idle timeout will default to 1 hour in 8.0.',
}),
documentationUrl:
'https://www.elastic.co/guide/en/kibana/current/xpack-security-session-management.html#session-idle-timeout',
correctiveActions: {
manualSteps: [
`Use "xpack.security.session.idleTimeout" in your Kibana configuration to change default session idle timeout.`,
`To disable session idle timeout, set "xpack.security.session.idleTimeout" to 0.`,
i18n.translate('xpack.security.deprecations.idleTimeout.manualStepOneMessage', {
defaultMessage: `Set "xpack.security.session.idleTimeout" in your Kibana configuration to override the default session idle timeout.`,
}),
i18n.translate('xpack.security.deprecations.idleTimeout.manualStepTwoMessage', {
defaultMessage: `To disable the session idle timeout, set "xpack.security.session.idleTimeout" to 0.`,
}),
],
},
});
}

if (settings?.xpack?.security?.session?.lifespan === undefined) {
addDeprecation({
message:
'Session lifespan ("xpack.security.session.lifespan") will be set to 30 days by default in the next major version (8.0).',
level: 'warning',
title: i18n.translate('xpack.security.deprecations.lifespanTitle', {
defaultMessage: 'The "xpack.security.session.lifespan" default is changing',
}),
message: i18n.translate('xpack.security.deprecations.lifespanMessage', {
defaultMessage: 'The session lifespan will default to 30 days in 8.0.',
}),
documentationUrl:
'https://www.elastic.co/guide/en/kibana/current/xpack-security-session-management.html#session-lifespan',
correctiveActions: {
manualSteps: [
`Use "xpack.security.session.lifespan" in your Kibana configuration to change default session lifespan.`,
`To disable session lifespan, set "xpack.security.session.lifespan" to 0.`,
i18n.translate('xpack.security.deprecations.lifespan.manualStepOneMessage', {
defaultMessage: `Set "xpack.security.session.lifespan" in your Kibana configuration to override the default session lifespan.`,
}),
i18n.translate('xpack.security.deprecations.lifespan.manualStepTwoMessage', {
defaultMessage: `To disable the session lifespan, set "xpack.security.session.lifespan" to 0.`,
}),
],
},
});
Expand Down

0 comments on commit d389bf5

Please sign in to comment.