sops seems to duplicate yaml comments in certain cases
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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