getsops / getsops/sops

Encrypted file that was modified outside of sops not decryptable, go panic.

Open
#588 3 comments 0 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

I am suddenly not able to decrypt a file anymore. I am not sure what the issue is. Here is the stacktrace:

sops --verbose -d -i spigot2.yml
[PGP]    INFO[0000] Decryption succeeded                          fingerprint=6862BCF4AFF6514F668E7A6059365879AABD9BFE
[SOPS]   INFO[0000] Data key recovered successfully
[SOPS]   DEBU[0000] Decrypting tree
panic: interface conversion: interface {} is int, not string

goroutine 1 [running]:
go.mozilla.org/sops.Tree.Decrypt.func1.1(0xecd640, 0xc0003dc0e0, 0xc0003ce170, 0x1, 0x1, 0x0, 0x415b5f, 0x7f6416e6c500, 0x20300000000000)
        /home/travis/gopath/src/go.mozilla.org/sops/sops.go:415 +0x991
go.mozilla.org/sops.TreeBranch.walkValue(0xc00028d600, 0x7, 0x8, 0xecd640, 0xc000386560, 0xc0003ce170, 0x1, 0x1, 0xc000264438, 0x7f641704cfff, ...)
        /home/travis/gopath/src/go.mozilla.org/sops/sops.go:225 +0x81c
go.mozilla.org/sops.TreeBranch.walkBranch(0xc00028d600, 0x7, 0x8, 0xc00028d600, 0x7, 0x8, 0x1b3cb58, 0x0, 0x0, 0xc000264438, ...)
        /home/travis/gopath/src/go.mozilla.org/sops/sops.go:278 +0x4c2
go.mozilla.org/sops.Tree.Decrypt.func1(0xc00028d600, 0x7, 0x8, 0xc0003ce160, 0x1)
        /home/travis/gopath/src/go.mozilla.org/sops/sops.go:370 +0x195
go.mozilla.org/sops.Tree.Decrypt(0x0, 0xed56d23eb, 0x0, 0xc000386de0, 0xc, 0x0, 0x0, 0x0, 0x0, 0xc0002a4360, ...)
        /home/travis/gopath/src/go.mozilla.org/sops/sops.go:436 +0x27c
go.mozilla.org/sops/cmd/sops/common.DecryptTree(0xc00032bba0, 0xc000368470, 0x1, 0x1, 0x0, 0x12c5480, 0xc00035e570, 0xc000368470, 0x1, 0x1, ...)
        /home/travis/gopath/src/go.mozilla.org/sops/cmd/sops/common/common.go:57 +0x1ed
main.decrypt(0x12c5480, 0xc00035e570, 0x7f64197f8728, 0x1b3cb58, 0x7f64197f8728, 0x1b3cb58, 0xc00013e9c0, 0x36, 0x0, 0x0, ...)
        /home/travis/gopath/src/go.mozilla.org/sops/cmd/sops/decrypt.go:34 +0x1f9
main.main.func6(0xc0000b1080, 0x0, 0x0)
        /home/travis/gopath/src/go.mozilla.org/sops/cmd/sops/main.go:572 +0x2b12
gopkg.in/urfave/cli%2ev1.HandleAction(0xeeb3e0, 0x10f2c78, 0xc0000b1080, 0x0, 0x0)
        /home/travis/gopath/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:490 +0xc8
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc0002eed00, 0xc0000c0000, 0x5, 0x5, 0x0, 0x0)
        /home/travis/gopath/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:264 +0x57c
main.main()
        /home/travis/gopath/src/go.mozilla.org/sops/cmd/sops/main.go:720 +0x2860

This is a yaml file encrypted with pgp.

sops 3.5.0 (latest)
Ubuntu 18.04.3 LTS amd64

Feel free to message me privately if you would like the yaml file and PGP key.

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 in sops.go at Tree.Decrypt around line 415, using the reported panic and the encrypted YAML modified outside SOPS as the reproduction. Trace the decryption path and add a regression test for this input; done means decryption reports an error or succeeds without panicking.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.