-
Notifications
You must be signed in to change notification settings - Fork 958
stores: test for duplicate keys, reserve keyword (yaml only now) #1203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Looking at #596 (comment), it seems that perhaps |
This should fix #851. |
The README explicitly shows using I think #596 should probably be handled differently, like only treating it as binary if there is no other key than data and its value is a string. (I'm not sure which mechanism is used right now. Maybe detection is only based on the file name.) |
I did look a bit into detection; the detection is done purely by filename, not by anything else. Something that definitely can be improved is error handling in |
stores/json/store.go
Outdated
@@ -211,7 +211,9 @@ func (store Store) jsonFromTreeBranch(branch sops.TreeBranch) ([]byte, error) { | |||
|
|||
func (store Store) treeBranchFromJSON(in []byte) (sops.TreeBranch, error) { | |||
dec := json.NewDecoder(bytes.NewReader(in)) | |||
dec.Token() | |||
if _, err := dec.Token(); err != nil { | |||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please document what exactly this is doing? I guess this is "Tests for, but does not disallow, duplicate keys in json.", but it is totally unclear to me how this code achieves that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is (as far as I can tell, been a while) not required, it's just a drive-by change that I made: Token()
does return an error, and checking+returning it is correct.
Later on, the store.treeBranchFromJSONDecoder(dec)
call will internally do the same thing
func (store Store) treeItemFromJSONDecoder(dec *json.Decoder) (sops.TreeItem, error) {
var item sops.TreeItem
key, err := dec.Token()
if err != nil && err != io.EOF {
return item, err
}
So I guess I figured that we should do it on the very first instance too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except that this one fails when err == io.EOF
. Which I guess is OK. I would add a comment explaining that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to add a comment, but I'm not sure what to write: I don't quite see why we need to document why we handle an error. Usually, motivation/explanation is required as for why one omits to handle an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After dwelling in sources of the JSON module, I now understand why this change is correct.
The main problem I have with this change is that it takes a long time to figure out what it does, and since it is totally unrelated to the commit message it appears in it is very confusing to figure out where it comes from.
It would be a lot better to move this to a separate commit (or even a separate PR) with a clear commit message (something like "Make sure errors returned when extracting the first token are handled").
Also there is another potential error lurking here: the first return value also needs to be checked whether it's a {
. Otherwise LoadPlainFile
produces "strange" error messages that aren't very helpful:
$ echo '[]' | sops --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: Expected JSON object key, got ] of type json.Delim instead
$ echo '[}' | sops --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: invalid character '}' looking for beginning of value
$ echo '["foo","bar"]' | sops --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: invalid character '}' after array element
$ echo '["foo":"bar"}' | sops --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: invalid character ':' after array element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see what difference this makes. As far as I can tell this PR does not change the behaviour against master
This PR:
$ echo '[]' | go run ./cmd/sops/ --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: Expected JSON object key, got ] of type json.Delim instead
$ echo '[}' | go run ./cmd/sops/ --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: invalid character '}' looking for beginning of value
$ echo '["foo","bar"]' | go run ./cmd/sops/ --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: Expected JSON object key, got ] of type json.Delim instead
$ echo '["foo":"bar"}' | go run ./cmd/sops/ --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: invalid character ':' after array element
Master:
$ echo '[]' | go run ./cmd/sops/ --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: Expected JSON object key, got ] of type json.Delim instead
$ echo '[}' | go run ./cmd/sops/ --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: invalid character '}' looking for beginning of value
$ echo '["foo","bar"]' | go run ./cmd/sops/ --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: Expected JSON object key, got ] of type json.Delim instead
$ echo '["foo":"bar"}' | go run ./cmd/sops/ --encrypt --input-type json /dev/stdin
Error unmarshalling file: Could not unmarshal input data: invalid character ':' after array element
But sure I can remove this change if you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there is another potential error lurking here: the first return value also needs to be checked whether it's a {.
It should not literally check that it's a {
, since whitespace is also accepted. I think the error messages are pretty good.
Consider ["foo":"bar"}
. If we say error: it must start with {
, then I think we are mixing different layers, with different concerns.
- First of all, the input needs to be valid
json
. The value["foo":"bar"}
is not validjson
, because a json list cannot contain key-value pairs, so the parse fails. The user will have to fix up his json, there are many tools to validate / lintjson
. - Secondly, there are app-specific constraints on what is required of the json object: such as that it is a dict, not a list. But those come later, IMO.
If this app starts validating specific characters in the json stream, like "checked whether it's a {.", then it overreaches. And before you know it, you are basically taking on the maintenance of an in-house json parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not literally check that it's a
{
, since whitespace is also accepted. I think the error messages are pretty good.
Yes, it should for a literal {
, since whitespace has already been processed by the decoder.
First of all, the input needs to be valid
json
. The value["foo":"bar"}
is not validjson
, because a json list cannot contain key-value pairs, so the parse fails. The user will have to fix up his json, there are many tools to validate / lint json.
True, but did you also consider the []
example? Or tried out something like [{}]
? The error messages are not really helpful, because the code already mixes the two layers: it parses valid JSON, and at the same time only parses JSON objects.
Secondly, there are app-specific constraints on what is required of the json object: such as that it is a dict, not a list. But those come later, IMO.
The function is called treeBranchFromJSON
. It cannot process anything else than a JSON object.
In any case, this discusison IMO shows why this should not part of a totally unrelated commit. This has nothing to do with (not) checking for duplicate keys.
Rebased on main, a few tests seem to be failing, not quite sure why |
You did not sign-off your commits, which is required to accept our DCO. Please refer to https://github.com/getsops/sops/pull/1203/checks?check_run_id=16924447836 for more information. |
Fixed (on my branch, seems to be taking github some time to propagate the changes here) |
stores/json/store.go
Outdated
@@ -211,7 +211,9 @@ func (store Store) jsonFromTreeBranch(branch sops.TreeBranch) ([]byte, error) { | |||
|
|||
func (store Store) treeBranchFromJSON(in []byte) (sops.TreeBranch, error) { | |||
dec := json.NewDecoder(bytes.NewReader(in)) | |||
dec.Token() | |||
if _, err := dec.Token(); err != nil { | |||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except that this one fails when err == io.EOF
. Which I guess is OK. I would add a comment explaining that.
I squashed everything now.
I'd prefer to leave that to you, thanks |
` | ||
s := new(Store) | ||
_, err := s.LoadPlainFile([]byte(data)) | ||
assert.Nil(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point, we should extend this test to verify that re-serializing yields the same result.
assert.NotNil(t, err) | ||
assert.Equal(t, `yaml: unmarshal errors: | ||
line 3: mapping key "hello" already defined at line 2`, err.Error()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add a test which looks at multi-document YAML streams (with collisions in later documents).
This is looking good to me, but I think we should release a patch first before moving ahead with changes which force a new minor. |
|
@hiddeco should we merge this now? |
Any updates about this? the problem stills happening at version 3.8.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a rebase to resolve the conflict, but other than this (and a tiny nit) it looks good to me.
Sorry for the wait @holiman, and thanks for your contribution 🍍
@holiman can you rebase and use the constant? |
stores/json: use assert stores/yaml: fix failing test (empty data) stores/yaml: use assert in tests unfix error handling and ignore error Signed-off-by: Martin Holst Swende <martin@swende.se>
Const fixed + rebased |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [getsops/sops](https://github.com/getsops/sops) | minor | `v3.9.4` -> `v3.10.2` | 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.10.2`](https://github.com/getsops/sops/releases/tag/v3.10.2) [Compare Source](getsops/sops@v3.10.1...v3.10.2) #### 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.10.2/sops-v3.10.2.linux.amd64 ### Move the binary in to your PATH mv sops-v3.10.2.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.10.2/sops-v3.10.2.checksums.txt curl -LO https://github.com/getsops/sops/releases/download/v3.10.2/sops-v3.10.2.checksums.pem curl -LO https://github.com/getsops/sops/releases/download/v3.10.2/sops-v3.10.2.checksums.sig ### Verify the checksums file cosign verify-blob sops-v3.10.2.checksums.txt \ --certificate sops-v3.10.2.checksums.pem \ --signature sops-v3.10.2.checksums.sig \ --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.10.2.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.10.2.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.10.2/sops-v3.10.2.intoto.jsonl ### Verify the provenance of the artifact slsa-verifier verify-artifact <artifact> \ --provenance-path sops-v3.10.2.intoto.jsonl \ --source-uri github.com/getsops/sops \ --source-tag v3.10.2 ``` #### 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.10.2` - `ghcr.io/getsops/sops:v3.10.2-alpine` ##### Quay.io - `quay.io/getsops/sops:v3.10.2` - `quay.io/getsops/sops:v3.10.2-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.10.2 \ --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 the go group with 13 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1834 - Use latest 1.24 Go version for release build by [@​hiddeco](https://github.com/hiddeco) in getsops/sops#1836 - Remove reserved keyword check from YAML store's `LoadPlainFile()` by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1829 - build(deps): Bump the go group with 9 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1839 - build(deps): Bump github/codeql-action from 3.28.13 to 3.28.15 in the ci group by [@​dependabot](https://github.com/dependabot) in getsops/sops#1840 - Release 3.10.2 release by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1841 **Full Changelog**: getsops/sops@v3.10.1...v3.10.2 ### [`v3.10.1`](https://github.com/getsops/sops/releases/tag/v3.10.1) [Compare Source](getsops/sops@v3.10.0...v3.10.1) #### 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.10.1/sops-v3.10.1.linux.amd64 ### Move the binary in to your PATH mv sops-v3.10.1.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.10.1/sops-v3.10.1.checksums.txt curl -LO https://github.com/getsops/sops/releases/download/v3.10.1/sops-v3.10.1.checksums.pem curl -LO https://github.com/getsops/sops/releases/download/v3.10.1/sops-v3.10.1.checksums.sig ### Verify the checksums file cosign verify-blob sops-v3.10.1.checksums.txt \ --certificate sops-v3.10.1.checksums.pem \ --signature sops-v3.10.1.checksums.sig \ --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.10.1.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.10.1.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.10.1/sops-v3.10.1.intoto.jsonl ### Verify the provenance of the artifact slsa-verifier verify-artifact <artifact> \ --provenance-path sops-v3.10.1.intoto.jsonl \ --source-uri github.com/getsops/sops \ --source-tag v3.10.1 ``` #### 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.10.1` - `ghcr.io/getsops/sops:v3.10.1-alpine` ##### Quay.io - `quay.io/getsops/sops:v3.10.1` - `quay.io/getsops/sops:v3.10.1-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.10.1 \ --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 the ci group with 2 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1826 - Release 3.10.1 by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1827 **Full Changelog**: getsops/sops@v3.10.0...v3.10.1 ### [`v3.10.0`](https://github.com/getsops/sops/releases/tag/v3.10.0) [Compare Source](getsops/sops@v3.9.4...v3.10.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.10.0/sops-v3.10.0.linux.amd64 ### Move the binary in to your PATH mv sops-v3.10.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.10.0/sops-v3.10.0.checksums.txt curl -LO https://github.com/getsops/sops/releases/download/v3.10.0/sops-v3.10.0.checksums.pem curl -LO https://github.com/getsops/sops/releases/download/v3.10.0/sops-v3.10.0.checksums.sig ### Verify the checksums file cosign verify-blob sops-v3.10.0.checksums.txt \ --certificate sops-v3.10.0.checksums.pem \ --signature sops-v3.10.0.checksums.sig \ --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.10.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.10.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.10.0/sops-v3.10.0.intoto.jsonl ### Verify the provenance of the artifact slsa-verifier verify-artifact <artifact> \ --provenance-path sops-v3.10.0.intoto.jsonl \ --source-uri github.com/getsops/sops \ --source-tag v3.10.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.10.0` - `ghcr.io/getsops/sops:v3.10.0-alpine` ##### Quay.io - `quay.io/getsops/sops:v3.10.0` - `quay.io/getsops/sops:v3.10.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.10.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 alpine from 3.18 to 3.21 in /.release in the docker group across 1 directory by [@​dependabot](https://github.com/dependabot) in getsops/sops#1700 - Convert changelog to MarkDown by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1741 - build(deps): Bump the go group with 7 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1743 - build(deps): Bump the go group with 9 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1745 - build(deps): Bump the rust group in /functional-tests with 2 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1744 - build(deps): Bump github/codeql-action from 3.28.5 to 3.28.8 in the ci group by [@​dependabot](https://github.com/dependabot) in getsops/sops#1746 - build(deps): Bump the go group with 12 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1751 - build(deps): Bump the ci group with 4 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1750 - Add --input-type option for filestatus subcommand by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1601 - Use SOPS_EDITOR before EDITOR by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1611 - Allow users to disable version check via environment variable by [@​nicklasfrahm](https://github.com/nicklasfrahm) in getsops/sops#1684 - add duplicate section support to ini store by [@​reindlt](https://github.com/reindlt) in getsops/sops#1452 - stores: test for duplicate keys, reserve keyword (yaml only now) by [@​holiman](https://github.com/holiman) in getsops/sops#1203 - Add same process option for exec-env by [@​ricmatsui](https://github.com/ricmatsui) in getsops/sops#880 - outputs: add trailing newline at the end of JSON files by [@​duthils](https://github.com/duthils) in getsops/sops#1476 - set subcommand: add --idempotent flag that will not write the file if no change happened by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1754 - Encrypt and decrypt time.Time objects by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1759 - build(deps): Bump the go group with 8 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1763 - build(deps): Bump tempfile from 3.16.0 to 3.17.0 in /functional-tests in the rust group by [@​dependabot](https://github.com/dependabot) in getsops/sops#1762 - build(deps): Bump goreleaser/goreleaser-action from 6.1.0 to 6.2.1 in the ci group by [@​dependabot](https://github.com/dependabot) in getsops/sops#1761 - fix(docs): typo in README.rst by [@​Paredev](https://github.com/Paredev) in getsops/sops#1765 - Add SSH support for age by [@​haoqixu](https://github.com/haoqixu) in getsops/sops#1692 - make sure that tests do not pick keys.txt from user's HOME dir by [@​tomaszduda23](https://github.com/tomaszduda23) in getsops/sops#1766 - support for age identity with passphrase by [@​tomaszduda23](https://github.com/tomaszduda23) in getsops/sops#1400 - build(deps): Bump the rust group in /functional-tests with 4 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1768 - build(deps): Bump the go group with 12 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1769 - build(deps): Bump the ci group with 4 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1770 - build(deps): Bump github.com/go-jose/go-jose/v4 from 4.0.4 to 4.0.5 by [@​dependabot](https://github.com/dependabot) in getsops/sops#1773 - feat: add age plugin support by [@​brianmcgee](https://github.com/brianmcgee) in getsops/sops#1641 - Check GnuPG decryption result for non-empty size by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1776 - vendored age code: consolidate passphrase reading functionality by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1775 - Allow to encrypt and decrypt from stdin by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1690 - build(deps): Bump the go group with 11 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1784 - build(deps): Bump the ci group with 5 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1782 - build(deps): Bump serde_json from 1.0.139 to 1.0.140 in /functional-tests in the rust group; bump Rust to 1.85.0 by [@​dependabot](https://github.com/dependabot) in getsops/sops#1783 - build(deps): Bump the go group with 13 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1797 - build(deps): Bump the rust group in /functional-tests with 3 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1796 - build(deps): Bump github/codeql-action from 3.28.10 to 3.28.11 in the ci group by [@​dependabot](https://github.com/dependabot) in getsops/sops#1795 - build(deps): Bump the go group with 6 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1802 - build(deps): Bump tempfile from 3.18.0 to 3.19.0 in /functional-tests in the rust group by [@​dependabot](https://github.com/dependabot) in getsops/sops#1800 - build(deps): Bump docker/login-action from 3.3.0 to 3.4.0 in the ci group by [@​dependabot](https://github.com/dependabot) in getsops/sops#1801 - build(deps): Bump github.com/golang-jwt/jwt/v5 from 5.2.1 to 5.2.2 by [@​dependabot](https://github.com/dependabot) in getsops/sops#1806 - goreleaser: add windows arm64 by [@​duthils](https://github.com/duthils) in getsops/sops#1791 - Add a way to set sops config location via envvar by [@​sledzikowy](https://github.com/sledzikowy) in getsops/sops#1701 - build(deps): Bump the go group with 3 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1809 - build(deps): Bump the ci group with 5 updates by [@​dependabot](https://github.com/dependabot) in getsops/sops#1808 - build(deps): Bump tempfile from 3.19.0 to 3.19.1 in /functional-tests in the rust group by [@​dependabot](https://github.com/dependabot) in getsops/sops#1807 - Support --config option in publish subcommand by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1779 - Fix caching of Metadata.DataKey by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1781 - Lint by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1780 - updatekeys subcommand: rename GroupQuorum to ShamirThreshold by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1631 - If --filename-override is specified, convert it to an absolute path same as regular filenames by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1793 - Add support for `oauth2.TokenSource` in GCP KMS by [@​matheuscscp](https://github.com/matheuscscp) in getsops/sops#1794 - Added SOPS_AGE_KEY_CMD option to age, fixes [#​1323](getsops/sops#1323) by [@​danilobuerger](https://github.com/danilobuerger) in getsops/sops#1811 - chore: omitempty metadata to reduce the size of stored config by [@​cgetzen](https://github.com/cgetzen) in getsops/sops#1571 - Improve Shamir Secret Sharing code by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1813 - Update all dependencies by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1814 - Run 'gofmt -w' on all .go files by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1817 - Add option to explicitly check for the latest version; deprecate current default of always doing that unless disabled by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1816 - Build using Go 1.24 and drop support for 1.22 by [@​hiddeco](https://github.com/hiddeco) in getsops/sops#1819 - Support `GOOGLE_OAUTH_ACCESS_TOKEN` for Google Cloud Platform by [@​marensofier](https://github.com/marensofier) in getsops/sops#1578 - Warn about `.sops.yml` files found while searching for `.sops.yaml` by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1820 - Release 3.10.0 by [@​felixfontein](https://github.com/felixfontein) in getsops/sops#1815 - Added support for multiarch windows release binaries by [@​sabre1041](https://github.com/sabre1041) in getsops/sops#1823 #### New Contributors - [@​reindlt](https://github.com/reindlt) made their first contribution in getsops/sops#1452 - [@​ricmatsui](https://github.com/ricmatsui) made their first contribution in getsops/sops#880 - [@​Paredev](https://github.com/Paredev) made their first contribution in getsops/sops#1765 - [@​haoqixu](https://github.com/haoqixu) made their first contribution in getsops/sops#1692 - [@​brianmcgee](https://github.com/brianmcgee) made their first contribution in getsops/sops#1641 - [@​sledzikowy](https://github.com/sledzikowy) made their first contribution in getsops/sops#1701 - [@​matheuscscp](https://github.com/matheuscscp) made their first contribution in getsops/sops#1794 - [@​danilobuerger](https://github.com/danilobuerger) made their first contribution in getsops/sops#1811 - [@​cgetzen](https://github.com/cgetzen) made their first contribution in getsops/sops#1571 - [@​marensofier](https://github.com/marensofier) made their first contribution in getsops/sops#1578 - [@​sabre1041](https://github.com/sabre1041) made their first contribution in getsops/sops#1823 **Full Changelog**: getsops/sops@v3.9.4...v3.10.0 </details> --- ### Configuration 📅 **Schedule**: 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 [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMjIuMyIsInVwZGF0ZWRJblZlciI6IjM5LjI0MC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
I started looking into sops, which I find to be a really nice idea and implementation. Kudos!
However, when testing some edgecase scenarios, I found some rough corners.
Specifically, it was possible to, when editing the file, add a
sops
key. This was then encrypted, and when trying to open it later on, I gotThis is a bit so-so UX wise, since the only way to recover is to remove the sops-line, and then reopen the file with the
--ignore-mac
enabled, and then save it again.In general, it seems to me that
sops
should be strict about validation. In that sense, this PR:json
.sops
now).go fmt
.If you think this is a good idea, the reserved keyword should be applied for other formats too, and I can go ahead and make that change too.