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

Transit secret engine LIST /keys responds with 404 instead of empty list #8833

Closed
dnault opened this issue Apr 24, 2020 · 1 comment
Closed
Labels
bug Used to indicate a potential bug secret/transit

Comments

@dnault
Copy link

dnault commented Apr 24, 2020

When there are no keys, a LIST request to the /transit/keys HTTP endpoint gets a 404 response. Instead it should return a 200 response with an empty list of keys.

To Reproduce
Delete all the keys managed by transit. Then run:

curl -v -X LIST -H "X-Vault-Token: myAuthToken" localhost:8200/v1/transit/keys`
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8200 (#0)
> LIST /v1/transit/keys HTTP/1.1
> Host: localhost:8200
> User-Agent: curl/7.64.1
> Accept: */*
> X-Vault-Token: myroot
> 
< HTTP/1.1 404 Not Found
< Cache-Control: no-store
< Content-Type: application/json
< Date: Fri, 24 Apr 2020 00:57:27 GMT
< Content-Length: 14
< 
{"errors":[]}
* Connection #0 to host localhost left intact
* Closing connection 0```

Notice the HTTP/1.1 404 Not Found.

Expected behavior
Expected a 200 response with the normal response structure and an empty key list, something like:

{"request_id":"dca6eb2b-dcab-9b6f-94f2-0b193609c0ce","lease_id":"","renewable":false,"lease_duration":0,"data":{"keys":[]},"wrap_info":null,"warnings":null,"auth":null}

Environment:

  • Vault Server Version (retrieve with vault status): 1.4.0
  • Vault CLI Version (retrieve with vault version): n/a
  • Server Operating System/Architecture: official docker image
@pcman312 pcman312 added bug Used to indicate a potential bug question secret/transit and removed question labels Apr 24, 2020
@pcman312 pcman312 self-assigned this Apr 28, 2020
@cipherboy
Copy link
Contributor

@dnault This behavior is consistent across various APIs in Vault:

  • transit/keys
  • pki/roles
  • pki/issuers
  • pki/keys
  • ssh/roles

and probably many others. Changing this behavior now is almost certainly a breaking change for many (200 implies non-empty response list). As such, I don't think we'll be addressing this issue. See the original rationale in #1365.

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/transit
Projects
None yet
Development

No branches or pull requests

3 participants