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

Better error messaging for invalid relative paths on write #3162

Closed
ryanmcnamara opened this issue Aug 14, 2017 · 0 comments
Closed

Better error messaging for invalid relative paths on write #3162

ryanmcnamara opened this issue Aug 14, 2017 · 0 comments

Comments

@ryanmcnamara
Copy link

ryanmcnamara commented Aug 14, 2017

I tried to write a generic secret to an invalid path (it was interpreted as a relative path) was not great. I ran into this with the client go api, but here it is illustrated just the same with the cli (distilled down)

vault write secret/foo..bar "a=b"
Error writing data to secret/foo...bar: Error making API request.

URL: PUT http://127.0.0.1:8200/v1/secret/foo..bar
Code: 400. Errors:

* internal error

The logs contain

2017/08/14 18:24:36.162348 [ERROR] core: failed to run existence check: error=existence check failed: key cannot be relative path

A command like

vault write secret/foo.bar "a=b"

works just fine immediately following

Some issues:

  1. The logs say that the "key" cannot be a relative path, but it is in fact the path that is a relative path here, not one of the keys from the map. Terminology taken from here: https://www.vaultproject.io/api/secret/generic/index.html#create-update-secret
  2. The response is a 400 and yet "internal error" is in the content of the response
  3. One could potentially argue that "foo..bar" is not a relative path because the ".." does not come after a "/" For example the file system behaves differently (perhaps better):
➜  tmp mkdir x
➜  tmp cd x
➜  x mkdir a..b
➜  x ls
a..b
➜  x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant