getsops / getsops/sops

yaml file sequence items spaces after hyphen

Open
#514 15 comments 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

Ubuntu 18.04 and archlinux
sops v3.3.1

Have weird yaml thing, encrypted a file with lines that looks like

  ENV:
  - name: "AWS_KEY"
    value: "BLAHBLAHBLAH"
  - name: "AWS_REGION"
    value: "eu-west-1"
... etc..

SO i do `sops --encrypt file.yaml --output > file-sops.yaml
then do sops --decrypt file-sops.yaml > file-dec.yaml
the decrypted file now has those lines looking like

    ENV:
    -   name: AWS_KEY
        value: BLAHBLAHBLAH
    -   name: AWS_REGION
        value: eu-west-1

So, it's changed the yaml indent to 4 spaces, that's fine, it's in the spec,
But it's added 2 spaces to the 1 space that was between the key and the - for each sequence item key
yamlint blows up on this. though it doesn't cause issues in the python script that i then pass this config yaml to in my usecase, the CI issues yamllint causes are the problem.

The resulting yamllint output on my actual file in my environment, shows up like:

~$> yamllint myfile-dec.yaml 
myfile-dec.yaml
  1:1       warning  missing document start "---"  (document-start)
  10:8      error    too many spaces after hyphen  (hyphens)
  10:5      error    wrong indentation: expected 8 but found 4  (indentation)
  12:8      error    too many spaces after hyphen  (hyphens)
  14:8      error    too many spaces after hyphen  (hyphens)
  16:8      error    too many spaces after hyphen  (hyphens)
...etc...

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

Reproduce the issue with file.yaml, file-sops.yaml, and file-dec.yaml using the sops --encrypt and sops --decrypt commands shown. Compare the decrypted sequence formatting with yamllint output; done means decryption preserves valid sequence indentation without extra spaces after hyphens.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, yaml
Domain
cli, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.