Broken dotenv output for values with spaces
Open
Nobody has claimed this yet.
area/stores
not-a-bug
stores/dotenv
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
Strings containing spaces are not quoted nor escaped in output dotenv files. The only way I've found to produce proper dotenv files in such case is manually quoting each space in the source yaml as quoting isn't possible (related issue #949).
To reproduce
# BAD
$ echo -e "FOO: Some long string with spaces" | sops encrypt --filename-override .yaml | sops decrypt --filename-override .yaml --output-type dotenv
FOO=Some long string with spaces
# BAD
$ echo -e "FOO: 'Some long string with spaces'" | sops encrypt --filename-override .yaml | sops decrypt --filename-override .yaml --output-type dotenv
FOO=Some long string with spaces
# GOOD
$ echo -e "FOO: Some\ long\ string\ with\ spaces" | sops encrypt --filename-override .yaml | sops decrypt --filename-override .yaml --output-type dotenv
FOO=Some\ long\ string\ with\ spaces
Expected behavior
$ echo -e "FOO: Some long string with spaces" | sops encrypt --filename-override .yaml | sops decrypt --filename-override .yaml --output-type dotenv
FOO="Some long string with spaces"
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 CLI path for sops decrypt --output-type dotenv and reproduce the provided YAML examples. Done means a value containing spaces is emitted as FOO="Some long string with spaces" while preserving existing dotenv output behavior.
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
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100