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.17] Change elasticsearch.username: elastic deprecation level to critical #122717

Merged
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
8 changes: 5 additions & 3 deletions src/core/server/elasticsearch/elasticsearch_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,22 +289,24 @@ describe('throws when config is invalid', () => {
});

describe('deprecations', () => {
it('logs a warning if elasticsearch.username is set to "elastic"', () => {
const { messages } = applyElasticsearchDeprecations({ username: 'elastic' });
it('logs a critical deprecation if elasticsearch.username is set to "elastic"', () => {
const { messages, levels } = applyElasticsearchDeprecations({ username: 'elastic' });
expect(messages).toMatchInlineSnapshot(`
Array [
"Kibana is configured to authenticate to Elasticsearch with the \\"elastic\\" user. Use a service account token instead.",
]
`);
expect(levels).toEqual(['critical']);
});

it('logs a warning if elasticsearch.username is set to "kibana"', () => {
const { messages } = applyElasticsearchDeprecations({ username: 'kibana' });
const { messages, levels } = applyElasticsearchDeprecations({ username: 'kibana' });
expect(messages).toMatchInlineSnapshot(`
Array [
"Kibana is configured to authenticate to Elasticsearch with the \\"kibana\\" user. Use a service account token instead.",
]
`);
expect(levels).toEqual(['warning']);
});

it('does not log a warning if elasticsearch.username is set to something besides "elastic" or "kibana"', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/core/server/elasticsearch/elasticsearch_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const deprecations: ConfigDeprecationProvider = () => [

if (es.username === 'elastic' || es.username === 'kibana') {
const username = es.username;
const level = es.username === 'elastic' ? 'critical' : 'warning';
addDeprecation({
configPath: `${fromPath}.username`,
title: i18n.translate('core.deprecations.elasticsearchUsername.title', {
Expand All @@ -158,7 +159,7 @@ const deprecations: ConfigDeprecationProvider = () => [
'Kibana is configured to authenticate to Elasticsearch with the "{username}" user. Use a service account token instead.',
values: { username },
}),
level: 'warning',
level,
documentationUrl: `https://www.elastic.co/guide/en/elasticsearch/reference/${branch}/service-accounts.html`,
correctiveActions: {
manualSteps: [
Expand Down