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

Vault CLI KV2 Undelete for Multi-level Paths fails #19810

Closed
nickryand opened this issue Mar 28, 2023 · 0 comments · Fixed by #19811
Closed

Vault CLI KV2 Undelete for Multi-level Paths fails #19810

nickryand opened this issue Mar 28, 2023 · 0 comments · Fixed by #19811
Labels
bug Used to indicate a potential bug secret/kv

Comments

@nickryand
Copy link
Contributor

nickryand commented Mar 28, 2023

Describe the bug
Vault CLI fails to properly handle KV-V2 undelete commands when backend is mounted under a path that has multiple levels.

vault kv undelete -versions=1 -mount=secrets/myapp mysecret
Error writing data to myapp/undelete/mysecret: Error making API request.

URL: PUT http://127.0.0.1:8200/v1/myapp/undelete/mysecret
Code: 404. Errors:

* no handler for route "myapp/undelete/mysecret". route entry not found.

To Reproduce
Steps to reproduce the behavior:

$ vault server -dev
$ export VAULT_ADDR="http://127.0.0.1:8200"
$ export VAULT_TOKEN="***************************"
$ vault secrets enable -version=2 -path=secrets/myapp kv
$ vault kv put secrets/myapp/mysecret test=123
$ vault kv delete -mount=secrets/myapp mysecret
$ vault kv undelete -versions=1 -mount=secrets/myapp mysecret

Expected behavior
Vault CLI should properly handle the mounts that are deeper than a single layer. Current behavior truncates everything
before the last /

Environment:

  • Vault Server Version (retrieve with vault status):
vault status
Key             Value
---             -----
Seal Type       shamir
Initialized     true
Sealed          false
Total Shares    1
Threshold       1
Version         1.13.0
Build Date      n/a
Storage Type    inmem
Cluster Name    vault-cluster-74a1cb17
Cluster ID      725fb721-282c-81fc-b210-c80d5c99aadd
HA Enabled      false
  • Vault CLI Version (retrieve with vault version):
Vault v1.13.0 (cgo)
  • Server Operating System/Architecture:
Linux 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Vault server configuration file(s):

N/A just used the default dev server

Additional context

N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug secret/kv
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants