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

sops-import-keys-hook.bash uses unbound var #372

Open
sellout opened this issue Jul 27, 2023 · 0 comments
Open

sops-import-keys-hook.bash uses unbound var #372

sellout opened this issue Jul 27, 2023 · 0 comments

Comments

@sellout
Copy link

sellout commented Jul 27, 2023

On line 3,

  if [ -n "${sopsCreateGPGHome}" ]; then

uses sopsCreateGPGHome, which may be unbound (unless the user has set it). Since this file gets sourced into shells, it can break when it’s sourced into a shell with nounset (set -u) enabled (which I have just run into).

This should either also check that the variable is bound

  if [ -v sopsCreateGPGHome && -n "${sopsCreateGPGHome}" ]; then

or should bind it preemptively

sopsCreateGPGHome=
…
  if [ -n "${sopsCreateGPGHome}" ]; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant