getsops / getsops/sops

Quotes in env formatted file are handled unexpectedly when using exec-env

Open
#1,127 5 comments 3 reactions 0 assignees View on GitHub

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.