getsops / getsops/sops

Extension is not respected when extracting a subtree

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

The documentation talks about how the extension is used to determine the input format; however, this does not seem to be true for the output format, at least for the 'extract subtree' feature. The following command:

sops -d --output .secrets/synapse-inlined-secrets.yaml --extract '["synapse"]["inlined_secrets"]' secrets.json

... will result in JSON being output into .secrets/synapse-inlined-secrets.yaml, instead of YAML - specifically, the tab indentation makes it invalid as YAML. It feels like this should probably be outputting YAML automatically?

(Note that the subtree in this case is an object of values rather than a single value; this is necessary for the target configuration format.)

Version: sops 3.7.3

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 by reproducing the reported sops -d --output ... --extract command from the issue, then trace the --extract output-format handling. Done means an object subtree written to a .yaml output is emitted as valid YAML rather than JSON with tab indentation.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.