Skip to content

Preserve YAML inline comments through encrypt/edit roundtrip#2131

Merged
felixfontein merged 4 commits into
getsops:mainfrom
knowald:fix/yaml-inline-comment-roundtrip
Apr 17, 2026
Merged

Preserve YAML inline comments through encrypt/edit roundtrip#2131
felixfontein merged 4 commits into
getsops:mainfrom
knowald:fix/yaml-inline-comment-roundtrip

Conversation

@knowald
Copy link
Copy Markdown
Contributor

@knowald knowald commented Apr 1, 2026

Add Inline flag to Comment struct, set during YAML parsing when a comment originates from a LineComment property. During write-back, inline comments are restored as LineComment on the correct node instead of being collapsed into HeadComment on the next node.

Fixes #2130

@knowald knowald marked this pull request as draft April 1, 2026 09:22
@felixfontein felixfontein changed the title fix: preserve YAML inline comments through encrypt/edit roundtrip Preserve YAML inline comments through encrypt/edit roundtrip Apr 6, 2026
@knowald knowald marked this pull request as ready for review April 7, 2026 15:19
Copy link
Copy Markdown
Contributor

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that you need to sign-off your commit, otherwise this cannot be merged.

Comment thread stores/yaml/store.go Outdated
Comment thread stores/yaml/store.go Outdated
knowald added 2 commits April 7, 2026 17:42
Add Inline flag to Comment struct, set during YAML parsing when a
comment originates from a LineComment property. During write-back,
inline comments are restored as LineComment on the correct node
instead of being collapsed into HeadComment on the next node.

Fixes getsops#2130

Signed-off-by: Kevin Nowald <kevin@nowald.dev>
Signed-off-by: Kevin Nowald <kevin@nowald.dev>
@knowald knowald force-pushed the fix/yaml-inline-comment-roundtrip branch from de8d425 to 2fd2adc Compare April 7, 2026 15:42
@knowald
Copy link
Copy Markdown
Contributor Author

knowald commented Apr 7, 2026

Please note that you need to sign-off your commit, otherwise this cannot be merged.

Done, all commits are signed off now. Thanks for the heads up.

@felixfontein felixfontein merged commit e3e51e9 into getsops:main Apr 17, 2026
15 checks passed
@felixfontein
Copy link
Copy Markdown
Contributor

@knowald thanks for your contribution!

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request May 11, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [getsops/sops](https://github.com/getsops/sops) | minor | `v3.12.2` → `v3.13.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>getsops/sops (getsops/sops)</summary>

### [`v3.13.0`](https://github.com/getsops/sops/releases/tag/v3.13.0)

[Compare Source](getsops/sops@v3.12.2...v3.13.0)

#### Installation

To install `sops`, download one of the pre-built binaries provided for your platform from the artifacts attached to this release.

For instance, if you are using Linux on an AMD64 architecture:

```shell

# Download the binary
curl -LO https://github.com/getsops/sops/releases/download/v3.13.0/sops-v3.13.0.linux.amd64

# Move the binary in to your PATH
mv sops-v3.13.0.linux.amd64 /usr/local/bin/sops

# Make the binary executable
chmod +x /usr/local/bin/sops
```

##### Verify checksums file signature

The checksums file provided within the artifacts attached to this release is signed using [Cosign](https://docs.sigstore.dev/cosign/overview/) with GitHub OIDC. To validate the signature of this file, run the following commands:

```shell

# Download the checksums file, certificate and signature
curl -LO https://github.com/getsops/sops/releases/download/v3.13.0/sops-v3.13.0.checksums.txt
curl -LO https://github.com/getsops/sops/releases/download/v3.13.0/sops-v3.13.0.checksums.sigstore.json

# Verify the checksums file
cosign verify-blob sops-v3.13.0.checksums.txt \
  --bundle sops-v3.13.0.checksums.sigstore.json \
  --certificate-identity-regexp=https://github.com/getsops \
  --certificate-oidc-issuer=https://token.actions.githubusercontent.com
```

##### Verify binary integrity

To verify the integrity of the downloaded binary, you can utilize the checksums file after having validated its signature:

```shell

# Verify the binary using the checksums file
sha256sum -c sops-v3.13.0.checksums.txt --ignore-missing
```

##### Verify artifact provenance

The [SLSA provenance](https://slsa.dev/provenance/v0.2) of the binaries, packages, and SBOMs can be found within the artifacts associated with this release. It is presented through an [in-toto](https://in-toto.io/) link metadata file named `sops-v3.13.0.intoto.jsonl`. To verify the provenance of an artifact, you can utilize the [`slsa-verifier`](https://github.com/slsa-framework/slsa-verifier#artifacts) tool:

```shell

# Download the metadata file
curl -LO  https://github.com/getsops/sops/releases/download/v3.13.0/sops-v3.13.0.intoto.jsonl

# Verify the provenance of the artifact
slsa-verifier verify-artifact <artifact> \
  --provenance-path sops-v3.13.0.intoto.jsonl \
  --source-uri github.com/getsops/sops \
  --source-tag v3.13.0
```

#### Container Images

The `sops` binaries are also available as container images, based on Debian (slim) and Alpine Linux. The Debian-based container images include any dependencies which may be required to make use of certain key services, such as GnuPG, AWS KMS, Azure Key Vault, and Google Cloud KMS. The Alpine-based container images are smaller in size, but do not include these dependencies.

These container images are available for the following architectures: `linux/amd64` and `linux/arm64`.

##### GitHub Container Registry

- `ghcr.io/getsops/sops:v3.13.0`
- `ghcr.io/getsops/sops:v3.13.0-alpine`

##### Quay.io

- `quay.io/getsops/sops:v3.13.0`
- `quay.io/getsops/sops:v3.13.0-alpine`

##### Verify container image signature

The container images are signed using [Cosign](https://docs.sigstore.dev/cosign/overview/) with GitHub OIDC. To validate the signature of an image, run the following command:

```shell
cosign verify ghcr.io/getsops/sops:v3.13.0 \
  --certificate-identity-regexp=https://github.com/getsops \
  --certificate-oidc-issuer=https://token.actions.githubusercontent.com \
  -o text
```

##### Verify container image provenance

The container images include [SLSA provenance](https://slsa.dev/provenance/v0.2) attestations. For more information around the verification of this, please refer to the [`slsa-verifier` documentation](https://github.com/slsa-framework/slsa-verifier#containers).

#### Software Bill of Materials

The Software Bill of Materials (SBOM) for each binary is accessible within the artifacts enclosed with this release. It is presented as an [SPDX](https://spdx.dev/) JSON file, formatted as `<binary>.spdx.sbom.json`.

#### What's Changed

- build(deps): Bump google.golang.org/grpc from 1.79.1 to 1.79.3 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2110](getsops/sops#2110)
- build(deps): Bump the ci group with 3 updates by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2117](getsops/sops#2117)
- build(deps): Bump the ci group with 3 updates by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2126](getsops/sops#2126)
- build(deps): Bump github.com/go-jose/go-jose/v4 from 4.1.3 to 4.1.4 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2133](getsops/sops#2133)
- build(deps): Bump docker/login-action from 4.0.0 to 4.1.0 in the ci group by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2139](getsops/sops#2139)
- Improve error message for top-level arrays by [@&#8203;kushal9897](https://github.com/kushal9897) in [#&#8203;2138](getsops/sops#2138)
- build(deps): Bump github.com/aws/aws-sdk-go-v2/service/s3 from 1.96.0 to 1.97.3 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2142](getsops/sops#2142)
- docs: add get key permission requirement for Azure Key Vault when version is omitted by [@&#8203;Hanashiko](https://github.com/Hanashiko) in [#&#8203;2122](getsops/sops#2122)
- build(deps): Bump actions/upload-artifact from 7.0.0 to 7.0.1 in the ci group by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2149](getsops/sops#2149)
- Use prefixed and truncated key hash instead of location as GPG agent cache key by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2145](getsops/sops#2145)
- Drop support for Go 1.24 by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2141](getsops/sops#2141)
- build(deps): Bump go.opentelemetry.io/otel/sdk from 1.40.0 to 1.43.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2146](getsops/sops#2146)
- build(deps): Bump the go group across 1 directory with 21 updates by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2144](getsops/sops#2144)
- Add SOPS\_GCP\_KMS\_ENDPOINT and SOPS\_GCP\_KMS\_UNIVERSE\_DOMAIN env vars by [@&#8203;DnR-iData](https://github.com/DnR-iData) in [#&#8203;2114](getsops/sops#2114)
- Preserve YAML inline comments through encrypt/edit roundtrip by [@&#8203;knowald](https://github.com/knowald) in [#&#8203;2131](getsops/sops#2131)
- Update release for cosign v3 by [@&#8203;sabre1041](https://github.com/sabre1041) in [#&#8203;2082](getsops/sops#2082)
- build(deps): Bump the ci group with 3 updates by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2151](getsops/sops#2151)
- build(deps): Bump the go group with 12 updates by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2152](getsops/sops#2152)
- Update broken link in README by [@&#8203;manute](https://github.com/manute) in [#&#8203;2153](getsops/sops#2153)
- sops exec-file: make sure to set GID to correct value instead of UID by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2154](getsops/sops#2154)
- sops exec-file: improve error handling, reject non-local paths in `--filename` by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2155](getsops/sops#2155)
- Obtain `--indent` global flag value and pass it to store configs by [@&#8203;skirino](https://github.com/skirino) in [#&#8203;2156](getsops/sops#2156)
- build(deps): Bump the go group with 3 updates by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2159](getsops/sops#2159)
- build(deps): Bump goreleaser/goreleaser-action from 7.1.0 to 7.2.1 in the ci group by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2158](getsops/sops#2158)
- Update all Go dependencies with 'go get -t -u ./...' by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2165](getsops/sops#2165)
- Allow to have space-separated keys in SOPS\_AGE\_KEY by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2086](getsops/sops#2086)
- HC Vault: add allowlist support for acceptable HC Vault URLs by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2164](getsops/sops#2164)
- build(deps): Bump the go group with 5 updates by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2171](getsops/sops#2171)
- build(deps): Bump github/codeql-action from 4.35.2 to 4.35.3 in the ci group by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;2173](getsops/sops#2173)
- Use mapstructure to (de-)serialize internal metadata; move metadata processing from specific stores to general place by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2120](getsops/sops#2120)
- Release 3.13.0 by [@&#8203;felixfontein](https://github.com/felixfontein) in [#&#8203;2176](getsops/sops#2176)

#### New Contributors

- [@&#8203;kushal9897](https://github.com/kushal9897) made their first contribution in [#&#8203;2138](getsops/sops#2138)
- [@&#8203;Hanashiko](https://github.com/Hanashiko) made their first contribution in [#&#8203;2122](getsops/sops#2122)
- [@&#8203;DnR-iData](https://github.com/DnR-iData) made their first contribution in [#&#8203;2114](getsops/sops#2114)
- [@&#8203;knowald](https://github.com/knowald) made their first contribution in [#&#8203;2131](getsops/sops#2131)
- [@&#8203;manute](https://github.com/manute) made their first contribution in [#&#8203;2153](getsops/sops#2153)
- [@&#8203;skirino](https://github.com/skirino) made their first contribution in [#&#8203;2156](getsops/sops#2156)

**Full Changelog**: <getsops/sops@v3.12.2...v3.13.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNjkuNCIsInVwZGF0ZWRJblZlciI6IjQzLjE2OS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YAML store converts inline comments to preceding-line comments on encrypt/edit roundtrip

2 participants