Skip to content

sops seems to duplicate yaml comments in certain cases #865

@felder

Description

@felder

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions