Unquoted bool's makes dotenv output format barf
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
Given:
$ sops -d --pgp <key> test.yml
foo: false
bar: true
However, if we try to dump the same file as a dotenv, we get the following:
$ sops -d --pgp <key> --output-type dotenv test.yml
panic: interface conversion: interface {} is bool, not string
goroutine 1 [running]:
go.mozilla.org/sops/v3/stores/dotenv.(*Store).EmitPlainFile(0x23483b0, 0xc0001214b8, 0x1, 0x1, 0x0, 0x1da61b0, 0xc0005d4120, 0xc0005dd200, 0x20)
/private/tmp/sops-20210408-88082-6m5hl1/sops-3.7.1/stores/dotenv/store.go:122 +0x40f
main.decrypt(0x1da61b0, 0xc0005d4120, 0x9b1bc98, 0x23483b0, 0x1db2998, 0x23483b0, 0xc000174e40, 0x20, 0x0, 0x0, ...)
/private/tmp/sops-20210408-88082-6m5hl1/sops-3.7.1/cmd/sops/decrypt.go:47 +0x278
main.main.func8(0xc000286c60, 0x0, 0x0)
/private/tmp/sops-20210408-88082-6m5hl1/sops-3.7.1/cmd/sops/main.go:809 +0x2d85
gopkg.in/urfave/cli%2ev1.HandleAction(0x1a6afc0, 0x1c28bb8, 0xc000286c60, 0x0, 0x0)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:490 +0x82
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc0005009c0, 0xc00012c000, 0x7, 0x7, 0x0, 0x0)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:264 +0x5f5
main.main()
/private/tmp/sops-20210408-88082-6m5hl1/sops-3.7.1/cmd/sops/main.go:987 +0x3885
Quoting the boolean fixes the issue for dotenv output:
$ sops -d --pgp <key> test.yml
foo: "true"
bar: "true"
$ sops -d --pgp <key> --output-type dotenv test.yml
foo=true
bar=true
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 in stores/dotenv/store.go at Store.EmitPlainFile, the entry point named in the panic trace, and reproduce the failure with YAML boolean values such as foo: false and bar: true. Verify that decrypting with --output-type dotenv no longer panics and emits valid dotenv key-value lines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100