opensearch-project / opensearch-cli

A full-featured command line interface (CLI) for OpenSearch.
https://opensearch.org/docs/latest/clients/cli/
Apache License 2.0
44 stars 24 forks source link

[BUG] Config file permissions error output can be misleading #66

Closed dcarbone closed 1 year ago

dcarbone commented 1 year ago

What is the bug? I am embedding this cli into an opensearch image intended for localhost development with a preconfigured default profile. There is zero reason for this to be edited post construction, therefore I set the perms to 0400 in the image.

That resulted in the error:

Reason: permissions 400 for '/usr/share/opensearch/.opensearch-cli/config.yaml' are too open. It is required that your config file is NOT accessible by others

That error message is a bit misleading, as 400 is doing exactly what the error message is suggesting that I need to do.

I suggest one of two things:

  1. Change the message to: ...are incorrect. Please change permissions to %d where %d is the value of FilePermission
  2. Enable a "readonly" mode, whereby the ability to edit profiles is disabled when config file permissions do now allow for it.

Obviously the first option is the easiest :)

wbeckler commented 1 year ago

This is a good catch.

Feel free to submit a PR

VachaShah commented 1 year ago

This was fixed in PR #67