-
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
Support non-serialized nested JSON policy objects #3802
Comments
I guess I should also state the converse: It would be nice to expose the policy values as straight JSON as well. For example, I am writing CI tests for our checked-in policy + secret configuration. I am starting a local Vault server, provisioning all our configuration (with some fake root secrets like DB connection info), and then making assertions to sanity-check our configuration before it's merged and eventually deployed. For policies, a reasonable sanity-check is "all the secret paths referenced by all policies actually exist (i.e. there are no typos)". This would be very simple with JSON policies; you could write the test in any language with minimal dependencies. As is, I need to pull down the HCL string and parse it to extract the paths. |
We have no plans to change this, sorry. |
Is there a preferred process/forum for discussion of proposals like this? Has this been proposed and discarded before? A quick skim of the mailing list turned up mostly folks asking about problems sending policies via the API (which this might mitigate). I definitely get keeping the GitHub issue list clean, but think this might merit more thought. Please excuse the flurry of issues over the last few days as my team works through Vault integration. We've been thoroughly impressed with Vault so far - clean design, solid implementation. The few surprises/hiccups we've encountered (like this trickiness to posting policies via the API) would be great to smooth out while still in a 0.x.x release, and so we are raising them as we encounter them :-) |
Hi @jgiles, Proposals like this can be discussed on the mailing list or on GH; unfortunately this particular proposal is simply something we can't satisfy. The sys/policies/acl endpoint may need to take in other parameters in the future, and having it accept pure JSON makes doing so impossible without more magic than I'm comfortable with (as a security product we try to keep magic out of Vault). This isn't just theoretical; for EGPs we already accept additional parameters (https://www.vaultproject.io/api/system/policies.html#create-update-egp-policy). We separated out writing ACLs/RGPs/EGPs for cleanliness but had we stuck with sys/policy for all three we would have already run into this issue for ACLs too. We realize that JSON-escaping a JSON-encoded string is annoying, but we need to leave the API some breathing room. One way to deal with this might be to use |
BTW, thanks for the kind words :-D We know Vault has rough edges, thanks for bearing with them... |
Feature Request: Support non-serialized nested JSON policy objects
Environment:
Vault Config File:
Running
-dev
with default config.Startup Log Output:
Expected Behavior:
I expected to be able to POST policy objects as normal nested JSON.
Actual Behavior:
The server does not accept direct nested JSON policy objects; instead they must be passed as an escaped JSON string value.
Steps to Reproduce:
References:
#582 shows that this is not an unusual expectation.
Policy file from hashicorp/vault-provision-example shows how awkward things get when trying to write Vault policy resources for POSTing.
#3796 has some discussion of parsing HCL to JSON in the Vault client, which in this case would allow the whole file above to be written in HCL and used directly with
vault write
.The text was updated successfully, but these errors were encountered: