(feat? / bug?) To avoid erroring when encrypting a semi-empty yaml file
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
If you try to encrypt an empty .yaml file or one with only a comment in it, an index out of bounds error is thrown on on line 68.
https://github.com/mozilla/sops/blob/master/cmd/sops/encrypt.go#L58-L70
Error - Index out of bounds on line 68
# my entire yaml file
Okay
# my entire yaml file
{}
Ideas
I'm not sure what the desired outcome is, but I figure it shouldn't be a unmanaged runtime error.
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 with cmd/sops/encrypt.go around lines 58-70 and reproduce the failure using an empty YAML file and a file containing only a comment. Determine how these inputs reach the index access, then verify that encryption no longer produces an unmanaged index-out-of-bounds error; the issue does not specify the desired result beyond avoiding that error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100