getsops / getsops/sops

Result of sops encoded yaml file have inconsistent indentation

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

Here is a test yaml file:

hello:
  hello2:
    - sops: value
      sops2:
        sops3: value

Encrypt it with SOPS:

 sops -e test.yaml
hello:
    hello2:
        - sops: ENC[AES256_GCM,data:rLOq/m0=,iv:e02zP+IuYoHdh6y5l13Lmd/Csh1zjgQ1v5tGjzLsyEA=,tag:iIobTHf40HkgtUO2ep5hOQ==,type:str]
          sops2:
            sops3: ENC[AES256_GCM,data:O/SwQd0=,iv:DfN2KCmj8D3D0P5M28/kQBcoWPTbUJO3rnw5K4PN2Ow=,tag:OWstfacX86bm1Xa93mJw5A==,type:str]
sops:
    kms: []
    gcp_kms: []
    azure_kv: []
    hc_vault: []
    age:
        - recipient: age1zeqkpfz7e3s207ynea0z0auc0mrct0pc7w4sh6j3d0c4qac3dahqj9ufdg
          enc: |
            -----BEGIN AGE ENCRYPTED FILE-----
            YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBqSTFsMEZVRjlSQVVzSVB5
            YllVdmZJelh4d3ZXKzF5dUtic1BYZkdTUHdNCk94RWNkeDJxRU02QkhYUGJLQnZ0
            aDNrdFQ5VTRsUHp4RmJ3R1lnNi9xUncKLS0tIFZzczkwYjV1M29UbDNuTCtGYWlV
            cHJQbDJ5UGwrYUNLT1JiS0pydFEraVUKjx2/UrSrzaWuJGBXGrbFpw1VhyBu2vVR
            DARFNAlmFsgHBq0bIq5SL9r5GKX2BJGeLuipuX/QGAZlVsib2dtaXw==
            -----END AGE ENCRYPTED FILE-----
    lastmodified: "2022-05-30T07:02:27Z"
    mac: ENC[AES256_GCM,data:PGgJz/LZkk3Wvh9lbPFa8bWvtI5WJ2N3nfLMs3GThzofGJ+p6GRaMuXdTFJJ/aXGH1vPBm+n67eIeHIr2Jne2tgcwGx3rzkLtfM3lauvNk5NzQ37DP2rfe2jE1phAsgW3CuYfYcCH/dShTogx4wIuL/mDJ3hGKYnTlEUmrEfta4=,iv:2VNk7jj3vkupQfrdscIYRFLGd1HrV70sSoM8JUEzRqs=,tag:xOCUXJ8TUnzJr3oVylydCQ==,type:str]
    pgp: []
    unencrypted_suffix: _unencrypted
    version: 3.7.3

hello2 field is indented 4 spaces from hello while sops3 is indented 2 spaces from sops2.

Refs: https://github.com/mozilla/sops/issues/900

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 issue with the YAML example and the shown SOPS encryption command, then inspect the code that formats encrypted YAML output. Done means nested fields use consistent indentation while preserving valid YAML and encryption output.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.