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

safe doesn't canonicalize paths #106

Closed
thomasmitchell opened this issue Sep 21, 2017 · 2 comments
Closed

safe doesn't canonicalize paths #106

thomasmitchell opened this issue Sep 21, 2017 · 2 comments
Assignees

Comments

@thomasmitchell
Copy link
Contributor

Maybe it should. My personal issue is /secret/... has vault try to redirect to secret/... but safe can't handle that.

@jhunt
Copy link
Contributor

jhunt commented Sep 22, 2017

Specifically, this is happening when a POST is issued to a non-canonical URL, as in

safe x509 issue /secret/x --name foo

@jhunt
Copy link
Contributor

jhunt commented Sep 22, 2017

Here is what is ultimately going on:

Vault is canonicalizing paths (at least to the generic backend) when you retrieve them, but not when you store them. Consider:

jhunt ~ →  safe write secret/x foo=quux
foo: quux
jhunt ~ →  safe read secret/x
--- # secret/x
foo: quux

jhunt ~ →  safe write secret///x foo=boz
foo: boz
jhunt ~ →  safe read secret///x
--- # secret///x
foo: quux

There is literally no way we will ever get back the foo=boz value we wrote in the second call to safe write; it's lost to the ages.

To fix this, safe will have to canonicalize all paths it sees by:

  1. Stripping off leading and trailing forward slashes
  2. Replacing contiguous runs of 2 or more forward slashes with a single forward slash

@jhunt jhunt self-assigned this Sep 22, 2017
@Qarik-Group Qarik-Group deleted a comment from thomasmitchell Sep 22, 2017
@jhunt jhunt changed the title safe doesn't follow redirects safe doesn't canonicalize paths Sep 22, 2017
@jhunt jhunt closed this as completed in bc7a07c Sep 22, 2017
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

2 participants