gopanic on encryption
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
Calling sops.exe (win32 variant) from WSL can result into a gopanic:
sops.exe --encrypt --input-type yaml --output-type yaml 'D:\a\helm-secrets\helm-secrets\tests\tmp.jIEdrPlrTE\assets\values\sops\secrets.dec.yaml'
# panic: runtime error: index out of range [0] with length 0
#
# goroutine 1 [running]:
# main.encrypt({{0x1113158, 0xc00034bf50}, {0x2313fff4118, 0x183f800}, {0x2313fff4118, 0x183f800}, {0xc0000837a0, 0x57}, {0xc000085610, 0x1, ...}, ...})
# /home/runner/work/sops/sops/cmd/sops/encrypt.go:68 +0x634
# main.main.func8(0xc0003802c0)
# /home/runner/work/sops/sops/cmd/sops/main.go:790 +0xa38
# gopkg.in/urfave/cli%2ev1.HandleAction({0xce54c0, 0xebe7a8}, 0x57)
# /home/runner/work/sops/sops/vendor/gopkg.in/urfave/cli.v1/app.go:490 +0x5a
# gopkg.in/urfave/cli%2ev1.(*App).Run(0xc0001b1860, {0xc0000d4000, 0x7, 0x8})
# /home/runner/work/sops/sops/vendor/gopkg.in/urfave/cli.v1/app.go:[264](https://github.com/jkroepke/helm-secrets/runs/6939572961?check_suite_focus=true#step:20:265) +0x5e6
# main.main()
# /home/runner/work/sops/sops/cmd/sops/main.go:989 +0x3699
secrets.dec.yaml (cloud be any value)
global_secret: global_bar
key: |-
-----BEGIN PGP MESSAGE-----
wcFMAxYpv4YXKfBAARAAVzE7/FMD7+UWwMls23zKKLoTs+5w9GMvugn0wi5KOJ8P
PSrRY4r27VhwQH38gWDrzo3RCmO9414xZ0JW0HaN2Pgd3ml6mYCY/5RE7apgGZQI
3Im0fv8bhIwaP2UWPp74EXLzA3mh1dUtwxmuWOeoSq+Vm5NtbjkfUt/4MIcF5IAY
c+U4ZOdQlzgExwu+VtOpeBrkwfglh5fFuKqM8Fg1IICi/Pp6YAlpAdGqlt1zS4Pj
yjAS6eAvnpM0eA5hShuoO9JsAu4kVjaaBlipVpc1I2zdcT3H/1d7ASziwbKOm6jE
PJxzaMDxn0UfMjkhTaTZ8v27lz6W7qdlHdCWGGI348QkSoDotm7OzMC7ZLfps3+9
GrXo9Kwxkj6oy/thn92W2cRSeSD28g6kcUkHeG8L3mMv+gpTjIhM+Z8x3jJcVp2i
yoA2dO/kO2/HTcUfnEjppKigqUlRuKfDn8ercjYiq+foqtimH192iXXyRmltYlH0
GUSJ1FcNLAC9g0WLFPQnMFh5KxSweavpbdd6PILqEsyKvZpC5a+hzLKwGjWOveW1
K34QZf6Ay3CPCegAyGVjxmsg1vPKD+9WAZinveCl37l3cCQW1VZzbGkHgtLQ30Qr
DCRFZEstraLAQUf6VLAk9bPYX/fvkXmra970i/CfJjIg0SpOXbADBR4x+zRRZqrS
4AHkWTmhH/xXWyAgmh+sGs18OOFGfeC04AjhMmvg4uKzly6+4IDlNhPif2VpJYOi
EmU8gQoUsAHKYro0hPfzBZyJlL+TqCPgHeRPANVgm4Ww6RlVrNFpTy9H4m4s5y/h
EzAA
=jf7D
-----END PGP MESSAGE-----
service:
port: 81
If an output file is defined, the gopanic does not appear. It looks like something is strange with stdout in the WSL interop, anyways gopanics should be catch.
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 cmd/sops/encrypt.go:68 and follow the call from cmd/sops/main.go:790 that panics when sops.exe is invoked from WSL without an output file. Reproduce the YAML encryption command in the issue, comparing behavior with and without an output file. Done means the WSL invocation no longer panics and reports or handles the failure appropriately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100