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

Mount conflict inconsistency #2878

Closed
otakup0pe opened this issue Jun 15, 2017 · 8 comments · Fixed by #2919
Closed

Mount conflict inconsistency #2878

otakup0pe opened this issue Jun 15, 2017 · 8 comments · Fixed by #2919
Milestone

Comments

@otakup0pe
Copy link
Contributor

We stumbled across something interesting with regards to how generic mountpoint conflicts are handled. We are not sure if this is the desired behavior or not. We understand that "sub mounts" are not supported, however this constraint seems to be only enforced in one direction.

This particular set of commands exhibits the behavior we expect.

$ vault mount -path foo generic
Successfully mounted 'generic' at 'foo'!
$ vault mount -path foo/bar generic
Mount error: Error making API request.

URL: POST http://127.0.0.1:8200/v1/sys/mounts/foo/bar
Code: 400. Errors:

* existing mount at foo/

The next set is what we find confusing. One might (possibly naively) expect that the second command, a "sub mount", would conflict with the first. Instead what we see is that the second mount works fine, with the third behaving consistently (as compared to the first example).

$ vault mount -path fom/bar generic
Successfully mounted 'generic' at 'fom/bar'!
$ vault mount -path fom generic
Successfully mounted 'generic' at 'fom'!
$ vault mount -path fom/baz generic
Mount error: Error making API request.

URL: POST http://127.0.0.1:8200/v1/sys/mounts/fom/baz
Code: 400. Errors:

* existing mount at fom/

If this is considered a bug, I'm totally willing to submit a pull request to fix it. If it is not, then I am totally willing to to submit a pull request to clarify the documentation.

@jefferai
Copy link
Member

Hi Jonathan,

It's a bug. We should not only check to see if the new value is a sub mount, of an existing mount, but if it would also be a parent mount to an existing mount. Looking forward to the PR!

@jefferai jefferai added this to the 0.7.4 milestone Jun 16, 2017
@otakup0pe
Copy link
Contributor Author

Sounds good! To confirm - the desired behavior is detection of any potential sub-path conflict?

@jefferai
Copy link
Member

Yep!

Thinking about it there are two ways to solve this. One is traveling up the path hierarchy and looking for conflicts along the way. The other is to simply only allow top level mounts. It'd potentially be a breaking change but I wonder if there is a point in allowing non top level mounts if you can't sub mount.

@otakup0pe
Copy link
Contributor Author

I'm leaning towards the first option. Disallowing non top-level mounts seems way too opinionated for a piece of software like Vault...

@jefferai
Copy link
Member

I mean, mounts are Vault fakery in the first place :-) But I agree.

@jefferai
Copy link
Member

@otakup0pe Just wanted to check, are you still intending to work up a PR for this?

@otakup0pe
Copy link
Contributor Author

I've started poking at it, I'll make sure to reference this issue if I get a PR up...

@jefferai
Copy link
Member

Sure. I think it's not too bad actually. We're not worried about speed in this path so really all you have to do is start with the given mount path, then in a loop knock one character off each iteration and check if that path exists.

otakup0pe pushed a commit to otakup0pe/vault that referenced this issue Jun 24, 2017
Ensure that we are not creating a "submount" underneath an already
existing mountpoint. This (hopefully) fixes hashicorp#2878
@jefferai jefferai modified the milestones: 0.7.4, 0.8.0 Jul 24, 2017
@jefferai jefferai modified the milestones: 0.8.0, next-release Aug 3, 2017
@jefferai jefferai modified the milestones: next-release, 0.8.2 Aug 18, 2017
@jefferai jefferai modified the milestones: 0.8.2, 0.8.3 Aug 31, 2017
@jefferai jefferai modified the milestones: 0.8.3, 0.8.4 Sep 25, 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

Successfully merging a pull request may close this issue.

2 participants