redhat-cop / vault-config-operator

An operator to support Haschicorp Vault configuration workflows from within Kubernetes
Apache License 2.0
110 stars 49 forks source link

avoid nil pointer dereference in RandomSecret processing #155

Closed tmmorin closed 1 year ago

tmmorin commented 1 year ago

Closes #102 Closes #153

As explained at https://github.com/hashicorp/vault/issues/8361, vaultClient.Logical().Read can return nil if there is nothing data at the specified path.

To avoid a nil pointer dereference, we need to check that response != nil.

This PR, in the second commit, adds an additional checks to ensure that don't mistakenly misbehave if no password was returned by Vault.

raffaelespazzoli commented 1 year ago

thanks for this PR, LGTM.

raffaelespazzoli commented 1 year ago

just one note, what o you mean when you say fixes #102? that issue is not open...

tmmorin commented 1 year ago

just one note, what o you mean when you say fixes #102? that issue is not open...

See my recent comments in #102 , I have a strong impression that #102 was possibly closed too early without having been fully fixed.

tmmorin commented 1 year ago

Thank you for merging! :)