Quotes in env formatted file are handled unexpectedly when using exec-env
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
When using exec-env on an env formatted file, quotes are included in the resulting environment variable.
secrets.env:
secret1='foo'
secret2="bar"
$ sops exec-env secrets.env 'echo $secret1'
'foo'
$ sops exec-env secrets.env 'echo $secret2'
"bar"
I would expect that environment variables would be set as if the file was sourceed or the variables were defined manually.
$ secret1='foo'; echo $secret1
foo
$ secret2="bar"; echo $secret2
bar
I realize this probably isn't actually a bug and it makes sense that the environment variable is set to the literal value in the context of other formats, but I think there should be special handling for quotes when the env format is used.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the exec-env entry point and reproduce the commands with the quoted values in secrets.env. Trace how the env format parses those values; done means quoted values are exposed without the surrounding quotes, matching shell assignment behavior while preserving handling for other formats.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100