hashicorp / hashicorp/consul-template

can't pass array argument to `secret`

Open
#1,194 2 comments 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
4.8k
Forks
801
Avg merge
4h 5m
Merged PRs (30d)
6

Description

Template: `{{with secret "/auth/token/create" "policies=policy1,policy2"}}{{.Auth.ClientToken}}{{ end }}`

### Expected behavior

What should have happened?

I should get a new token with policies "policy1" and "policy2".

### Actual behavior

I get an error, `* child policies must be subset of parent`. This is because my `policies` argument is being treated as a single policy with a comma in its name, rather than two separate policies.

### Discussion

The parsing code for the `secret` function treats argument values as strings. There's no way to pass an array as is expected by the `policies` argument to `auth/token/create`.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the parsing code for the `secret` function and how it passes arguments to `auth/token/create`. Verify how `policies=policy1,policy2` is represented before reaching the API, then check the relevant tests or add coverage for multiple policies. Done means the template produces a token with both policies rather than treating them as one name.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.