getsops / sops

Simple and flexible tool for managing secrets
https://getsops.io/
Mozilla Public License 2.0
16.85k stars 876 forks source link

Result of sops encoded yaml file have inconsistent indentation #1066

Open budimanjojo opened 2 years ago

budimanjojo commented 2 years ago

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

anutator commented 1 year ago

I have the same problem.