Skip to content

Setting.exists reflects secure settings but .get doesnt #41830

@tvernum

Description

@tvernum

Setting.exists is implemented by checking whether the key is in Settings.keySet()
But keySet returns the union of standard settings and secure settings, so this means that a setting is considered to exist if it is in either elasticsearch.yml or elasticsearch.keystore
However Setting.get() does not read secure settings, so code that tries to do

if (setting.exists()) {
  return setting.get();
} else {
 // ...
}

Will do the wrong thing if the setting has been (presumably incorrectly) added to the keystore.

My proposal would be to add a keySet(boolean includeSecureSettings) to Settings, and have exists (in non-secure Setting) call that with false.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions