getsops / getsops/sops

sops seems to duplicate yaml comments in certain cases

Open
#865 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
23.1k
Forks
1.1k
Avg merge
1d 11h
Merged PRs (30d)
9

Description

I have no idea how many cases this happens in, but I found at least one case where sops duplicates comments in yaml files.

I'm able to reproduce this with the following steps.

First create a yaml file with the following content:

a:
    b:
        c:
            - name: test_1
              test: a
            # I get duplicated
            - name: test_2
              test: b

Then encrypt it with sops.

$ cat test.yaml
a:
    b:
        c:
            - name: test_1
              test: a
            # I get duplicated
            - name: test_2
              test: b
$ sops --version
sops 3.7.1 (latest)
$ sops -e --verbose -i test.yaml
[GCPKMS]	 INFO[0000] Encryption succeeded                          resourceID=REMOVED
[CMD]	 INFO[0000] File written successfully

Now decrypt it with sops.

$ sops -d test.yaml
a:
    b:
        c:
            - name: test_1
              test: a
            # I get duplicated
            # I get duplicated
            # I get duplicated
            - name: test_2
              test: b

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 report with the provided test.yaml content using sops 3.7.1, then trace the YAML encryption and decryption paths responsible for comment handling. Done means decrypting the example emits the comment once rather than duplicating it.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
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.