getsops / getsops/sops

Broken dotenv output for values with spaces

Open
#1,951 1 comment 1 reaction 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.