[VAULT-14990] Support retrieving kv secret paths with trailing spaces (#15188)

This commit is contained in:
AnPucel 2022-05-10 14:07:45 -07:00 committed by GitHub
parent 15a9b32a58
commit ba88b1da16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

3
changelog/15188.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
cli: kv get command now honors trailing spaces to retrieve secrets
```

View File

@ -124,7 +124,8 @@ func (c *KVGetCommand) Run(args []string) int {
// Parse the paths and grab the KV version
if mountFlagSyntax {
// In this case, this arg is the secret path (e.g. "foo").
partialPath = sanitizePath(args[0])
partialPath = args[0]
mountPath = sanitizePath(c.flagMount)
_, v2, err = isKVv2(mountPath, client)
if err != nil {
@ -134,7 +135,8 @@ func (c *KVGetCommand) Run(args []string) int {
} else {
// In this case, this arg is a path-like combination of mountPath/secretPath.
// (e.g. "secret/foo")
partialPath = sanitizePath(args[0])
partialPath = args[0]
mountPath, v2, err = isKVv2(partialPath, client)
if err != nil {
c.UI.Error(err.Error())