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

Append trailing slash to folder listing in etcd3 backend #3406

Merged
merged 1 commit into from
Oct 6, 2017

Conversation

benpaxton-hf
Copy link
Contributor

Fixes an issue with etcd3 where listing keys in Vault can result in things that aren't children of the requested path being returned as if they were.

If you have a key secret/foo/bar, and a key secret/foobar/baz, and ask for a list of secret/foo, etcd3's non-hierarchical setup will return secret/foo/bar -> bar, and secret/foobar/baz -> bar/. Appending a slash causes secret/foobar/baz to no longer match, so the expected results are returned.

To show the issue;

vault write secret/foo/bar value=123
vault write secret/foobar/baz value=123

vault list secret/foo
vault list secret/fo

With etcd2:

$ vault list secret/foo
Keys
----
bar
$ vault list secret/fo
No value found at secret/fo/

With etcd3, before this PR:

$ vault list secret/foo
Keys
----
bar
bar/
$ vault list secret/fo
Keys
----
o/
obar/

With etcd3, after this PR:

$ vault list secret/foo
Keys
----
bar
$ vault list secret/fo/
No value found at secret/fo/

@jefferai
Copy link
Member

jefferai commented Oct 2, 2017

@benpaxton-hf What version of Vault is the server? Modern Vault automatically adds slashes at the end of list operations within the HTTP API, so this shouldn't be necessary.

@jefferai jefferai added this to the 0.8.4 milestone Oct 2, 2017
@benpaxton-hf
Copy link
Contributor Author

benpaxton-hf commented Oct 2, 2017 via email

@jefferai
Copy link
Member

jefferai commented Oct 2, 2017

Ah, that makes sense. Looks good, then.

@jefferai jefferai merged commit 44e0def into hashicorp:master Oct 6, 2017
@benpaxton-hf benpaxton-hf deleted the etcd-folder-list branch October 10, 2017 15:25
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

Successfully merging this pull request may close these issues.

2 participants