-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
sys: don't set X-Vault-Namespace
header for root-only paths
#14934
Comments
Hello and thanks for opening this issue; I've confirmed the behavior you've described. I'll work this through our processes and get a solution together. Feel free to follow this issue for updates! |
I'm not sure the expected behaviour is a good idea. We may change some root-only paths to be available in namespaces in the future. And if you're specifying X-Vault-Namespace, you probably authenticated into that namespace, and won't be likely to have access to the root-only paths anyway unless they're unauthenticated. If the client doesn't provide the namespace header for root-only API paths, IMO that's putting too much knowledge of possibly version-specific Vault behaviour into the client. If Vault ignores the specific namespace because it knows that the request doesn't make sense in a namespace but would make sense in the root namespace, that feels like surprising magical behaviour that could come back to bite us in the future, that would be backwards incompatible, and that doesn't seem justified relative to the minor pain associated with having to set the namespace header appropriately for these root-level requests. Also note that on HCP Vault there is no access to the root namespace, so this behaviour wouldn't make sense at all there. My suggestion is that you either use two clients for the two different namespaces, or that we find some way to make it easier to specify a namespace on a per-request basis, but still require that it be an explicit choice in the client code that the code author must be aware of. |
Just to elaborate on a possible use case: From the client perspective this is a total surprise.
Then this behavior should be documented more explicitly IMO. In particular since certain API paths are currently tied to one namespace. |
Hello @aead I just wanted to loop back and update you; after some internal discussion, we decided a good approach was to introduce a new method |
Describe the bug
Vault exposes root-only API paths. For example: `sys/health.
Ref: https://www.vaultproject.io/docs/enterprise/namespaces#root-only-api-paths
However, a
vault.Client
with a namespace set viaSetNamespace
sends theX-Vault-Namespace
header to those root-only API paths.For example:
This causes Vault
1.9.1
to respond with:To Reproduce
As a simple reproducer - the 1st curl request succeeds while the 2nd fails:
Expected behavior
Either the
vault.Client
should not send theX-Vault-Namespace
header for root-only API paths or Vault itself should ignore this header in such a case.Environment:
vault status
):1.9.1
vault version
):1.5.0
The text was updated successfully, but these errors were encountered: