You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An upstream package, github.com/ceph/ceph-csi expects this value to be a string and returns the error failed to initialize Vault connection: configuration option not valid: expected string for "vaultCAVerify", but got bool if a boolean is supplied. The upstream project parses the string into a boolean and then inverts it, passing a bool to InitVaultKMS. (This can be considered its own bug and I will also file one there.)
Clearly, getVaultParam() is expected to return a string, regardless of the type in secretConfig, which is declared as map[string]interface{}. A few lines later, ParseBool() is used to parse the value. In the failure scenario, skipVerify is returned as neither "true" nor "false" but the empty string.
This is caused by the following error in getVaultParam()
tokenStr, ok := tokenIntf.(string)
if !ok {
return ""
}
The cast to string does not stringize a boolean, but simply fails the cast.
Suggested remedy is to attempt cast to bool, and run strconv.FormatBool to return a string boolean.
The text was updated successfully, but these errors were encountered:
The getVaultParam() function is a misnomer since it always returns a string and could possibly be renamed to getVaultParamString(). For the api.EnvVaultInsecure parameter, I would suggest not using this function and instead directly handle the bool/string value.
Feel free to send out a PR to address this issue or we will fix it in a few days.
The
InitVaultKMS()
function invault/vault.go
takes a map. One of the parameters that it can take isvaultCAVerify: (string-bool)
.Example:
An upstream package,
github.com/ceph/ceph-csi
expects this value to be a string and returns the errorfailed to initialize Vault connection: configuration option not valid: expected string for "vaultCAVerify", but got bool
if a boolean is supplied. The upstream project parses the string into a boolean and then inverts it, passing abool
toInitVaultKMS
. (This can be considered its own bug and I will also file one there.)The first few lines of configureTLS read:
Clearly,
getVaultParam()
is expected to return a string, regardless of the type in secretConfig, which is declared asmap[string]interface{}
. A few lines later,ParseBool()
is used to parse the value. In the failure scenario, skipVerify is returned as neither "true" nor "false" but the empty string.This is caused by the following error in
getVaultParam()
The cast to string does not stringize a boolean, but simply fails the cast.
Suggested remedy is to attempt cast to bool, and run
strconv.FormatBool
to return a string boolean.The text was updated successfully, but these errors were encountered: