Conceal not working
Given a .drone.yml
of
pipeline:
test:
image: alpine:3.4
commands:
- 'echo "${SECRET}"'
Having a secret of
{
"test": "value",
"multi": "multi\nline\nstring"
}
And adding that secret with
drone secret add --conceal jmccann/test SECRET @file.json
I would expect the logs to conceal the secrets, but they do not seem to:
{"proc":"test","pos":0,"out":"+ echo \"\"{\\n \\\"test\\\": \\\"value\\\",\\n \\\"multi\\\": \\\"multi\\\\nline\\\\nstring\\\"\\n}\\n\"\""},
{"proc":"test","pos":1,"out":"{n \"test\": \"value\",n \"multi\": \"multi\\nline\\nstring\"n}n"},
{"proc":"test","type":2,"pos":0,"out":"0"},
{}]
With a “simple” string of abc123
secret I do see expected masking:
{"proc":"test","pos":0,"out":"+ echo \"*****\""},
{"proc":"test","pos":1,"out":"*****"},
{"proc":"test","type":2,"pos":0,"out":"0"},
{}]
Passing multiline secret to environment not working
Given:
pipeline:
test:
image: alpine:3.4
environment:
- DPASS=${SECRET}
commands:
- 'echo "$DPASS"'
With multiline secret contents and method of adding described in previous section it tries to build but provides error:
ERROR: yaml: line 4: mapping values are not allowed in this context
With a “simple” secret of abc123
it works fine.
Current Workaround
Given the multiline secret above we are doing the following to workaround the issue.
pipeline:
test:
image: alpine:3.4
commands:
- 'echo "$SECRET"'
This works because (for now?) secrets are still injected as shell envvars.
Questions
- Should
conceal
be expected to work in the above use case? If so I can open an issue. - Should setting an
environment
variable from a multiline secrets be expected to work? If so I can open an issue. - Are secrets going to ever stop being injected into the containers now that interpolation is deployed or will it continue to stick around? We are trying to come up with a “future proof” solution as best we can.
How we ran into all of this is we are using a multiline secret as described above to echo
the contents to a file without exposing the secret in my logs.