getsops / getsops/sops

(feat? / bug?) To avoid erroring when encrypting a semi-empty yaml file

Open
#748 0 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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.