Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

cannot pass array of rules #57

Closed
jmls opened this issue Dec 31, 2015 · 5 comments
Closed

cannot pass array of rules #57

jmls opened this issue Dec 31, 2015 · 5 comments

Comments

@jmls
Copy link

jmls commented Dec 31, 2015

Following on from the excellent work done in #46 , there is a small problem in that although the vaulted code allows it, passing an array of rules to createPolicy barfs on the vault side

 vault.createPolicy({
            id: "path1",
            body: {
              rules: [{"secret/path1": {policy: "write"}}]
            }
        })

gives an error of

error: { errors: [ 'Failed to parse ACL rules: Line 1, column 1: syntax error' ] },

but if you pass in

 rules: {"secret/path1": {policy: "write"}}

all is well

@kenjones-cisco
Copy link
Collaborator

There are no arrays, it is all still a hash. In the Vault issues, the question of getting examples of policies in json was submitted (hashicorp/vault#582). The last entry shows multiple policies example.

@jmls
Copy link
Author

jmls commented Jan 1, 2016

yeah, I was just looking at line 76 of policy.js where the code says

 (_.isPlainObject(options.body.rules) || _.isArray(options.body.rules))) {

so you are explicitly allowing an array to be passed - this will obviously not work, so I thought it would be better to throw an error at this point rather than at the vault side

@kenjones-cisco
Copy link
Collaborator

I thought an array might work at first but forgot to remove it. I will be dropping the check for array shortly.

@kenjones-cisco
Copy link
Collaborator

I will create add an item to include type checking for all parameters. Currently there is only checking for required inputs, but type checking has not been included as of yet.

Array check removed with commit a9afcb7

@kenjones-cisco
Copy link
Collaborator

Feature request #61 created

closing this request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants