getsops / getsops/sops

Support for using `--set` for array as value

Open
#1,133 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

As described in the documentation for the --set option, individual elements can be added to an array like this:

$ sops --set '["an_array"][1] "secretuser2"' ~/git/svc/sops/example.yaml

As a shortcut, it would be nice if it were also possible for a full JSON array to be specified as a value. When I try to do this, though, the value set into the encrypted file is null. For example:

$ sops --set '["an_array"] ["element"]' test.yaml

$ sops -d test.yaml
an_array: null

Note that I can set an array as the value for a property on a map:

$ sops --set '["arr"] {"nested": ["element"]}' test.yaml

$ sops -d test.yaml
an_array:
    nested:
        - element

Note that I was using version 3.7.3 for these tests.

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 the CLI's --set option and reproduce the documented array-value example using sops 3.7.3. Trace why a full JSON array becomes null while an array nested in a map works, then add coverage for direct array values and verify decryption preserves the elements.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.