1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00
Commit Graph

31 Commits

Author SHA1 Message Date
Felix Fontein
6bb6621897 Make SingleValueStore extend Store instead of the other way around.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-09-27 20:17:14 +02:00
Felix Fontein
ffc1e265bb Ignore encryption selection options for binary store (and warn when they are used).
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-09-27 20:17:14 +02:00
Sylvain Rabot
0bf4492b7e Switch from deprecated gopkg.in/yaml.v3 to go.yaml.in/yaml/v3
Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
2025-09-07 17:37:00 +02:00
Felix Fontein
6d4c21860e Remove reserved keyword check from YAML store's LoadPlainFile().
This check hid the better check in cmd/sops/encrypt.go.

Signed-off-by: Felix Fontein <felix@fontein.de>
2025-04-13 15:18:09 +02:00
Martin Holst Swende
adad27e2d4 stores: test for duplicate keys, reseve keyword (yaml only now)
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>
2024-09-27 15:58:34 +02:00
Felix Fontein
618b60e99c Create a constant for the 'sops' metadata key.
Signed-off-by: Felix Fontein <felix@fontein.de>
2023-12-29 22:55:57 +01:00
Felix Fontein
1bda828b69 Make check whether file contains invalid keys for encryption dependent on output store.
Signed-off-by: Felix Fontein <felix@fontein.de>
2023-12-29 22:22:01 +01:00
Bastien
8a63bb0d21 Add checks for indentation value
Signed-off-by: Bastien <bastien.wermeille@gmail.com>
2023-11-24 07:41:14 +01:00
Bastien Wermeille
6ad2a82d22 Refactor duplicated code
Signed-off-by: Bastien Wermeille <bastien.wermeille@gmail.com>
2023-11-24 07:41:14 +01:00
Bastien Wermeille
d2ee8df5de Implement feedback
Co-authored-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Bastien Wermeille <bastien.wermeille@gmail.com>
2023-11-24 07:41:14 +01:00
Bastien Wermeille
303fdd8f37 Add cli indent option for yaml store
Signed-off-by: Bastien Wermeille <bastien.wermeille@gmail.com>
2023-11-24 07:41:14 +01:00
James J. Goodhouse
e9e2346fdd Add configuration for stores
this will allow for setting of parameters specific to each store, such
as indentation level for YAML

Co-authored-by: Bastien Wermeille <bastien.wermeille@gmail.com>
Signed-off-by: James J. Goodhouse <jgoodhouse@newrelic.com>
2023-11-24 07:41:14 +01:00
Felix Fontein
38ec3f7a52 Handle unhandled errors.
Signed-off-by: Felix Fontein <felix@fontein.de>
2023-10-03 09:41:49 +02:00
Felix Fontein
a27e1bddf2 Ignore irrelevant return value (it is always nil).
Signed-off-by: Felix Fontein <felix@fontein.de>
2023-10-03 09:41:49 +02:00
Hidde Beydals
eeaf9f76d5 *: address various simple staticcheck warnings
Deprecation of `io/ioutil`, removal of unused functions, possible nil
pointer dereference, and other tiny nits.

There are (many) more, but these would require their own (commit)
context.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-17 00:16:40 +02:00
Hidde Beydals
f2a1d4c782 Rename Go module to github.com/getsops/sops/v3
This commit renames the Go module from `go.mozilla.org/sops/v3` to
`github.com/getsops/sops/v3` without a major version bump, to align
with new stewardship.

For more information around this change, refer to
https://github.com/getsops/sops/issues/1246.

For a one-liner to change the `go.mod` and any import paths in your
Go project making use of this module, run:

```
find /path/to/repo -type f \( -name "*.go" -o -name "go.mod" \) -exec sed -i 's|go.mozilla.org/sops/v3|github.com/getsops/sops/v3|g' {} \;
find /path/to/repo -type f \( -name "*.go" -o -name "go.mod" \) -exec sed -i '' 's|go.mozilla.org/sops/v3|github.com/getsops/sops/v3|g' {} \;
```

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-07-31 22:51:36 +02:00
Felix Fontein
b2d5f08258 Fix comment jumping. 2022-05-31 21:26:49 +02:00
ikedam
108b211cfb Allow empty maps for yaml (#907) 2021-07-24 15:37:49 +09:00
Felix Fontein
5af8e63ad5 Prevent comment duplication. (#866) 2021-05-08 19:43:55 +02:00
Felix Fontein
e2d6d0fdc3 Use yaml.v3 instead of modified yaml.v2 for handling YAML files (#791)
* Add another test (that currently fails).

* First shot at using yaml.v3 for reading YAML files with comments.

* Allow parsing multi-document YAML files.

* Use Decoder to parse multi-part documents.

* Use yaml.v3 for config and audit.

* First step of serializing YAML using yaml.v3.

* Always serialize with yaml.v3.

* Remove debug prints.

* Remove traces of github.com/mozilla-services/yaml.

* Improve serialization of documents consisting only of comments.

* Improve handling of some empty documents.

* Adjust to latest changes in go-yaml/yaml#684.

* Bump yaml.v3 version, temporarily disable failing tests.

* Run go mod tidy.

* Fix CI.
2021-02-21 18:48:23 +01:00
AJ Bahnken
8e21de8dbc Upgrade sops to go 1.13 (#566) 2019-11-18 10:06:58 -08:00
Adriano
4d4891588d address comments 2019-07-11 10:47:43 -07:00
Adriano
4b99fa18b3 go lint 2019-07-11 10:30:32 -07:00
Adrian Utrilla
bbf17b3d84 Consolidate example trees 2019-01-23 10:54:27 +01:00
James Robson
dfa150bf75 Add multidoc encrypt/decrypt for YAML sources 2018-11-21 09:00:49 -07:00
Adrian Utrilla
1ffc93dfb6 Refactor Store interface to reflect operations SOPS performs (#335)
* Refactor Store interface to reflect operations SOPS performs

Previously the Store interface tried to mimic the Marshaler and Unmarshaler
interfaces. This was a mistake, as it meant Stores had no idea whether the files they
were loading were encrypted or not.

Partially fixes #334

* Add regression test for loading plain JSON file with binary store
2018-04-20 10:13:46 +02:00
Adrian Utrilla
14a55401d3 Fix metadata not found returning the wrong error 2017-10-03 14:51:59 -07:00
Adrian Utrilla
7911bb1542 Merge branch 'master' into yaml-list-comments 2017-09-15 19:29:06 -07:00
Adrian Utrilla
93570b20d7 Fix golint errors 2017-09-12 09:59:23 -07:00
Adrian Utrilla
a9582158d2 Revert UnmarshalMetadata returning pointer 2017-08-29 12:16:00 -07:00
Adrian Utrilla
13b70024d0 Refactor metadata marshalling
**IMPORTANT** This breaks compatibility of the file format in 1.x for
json files, due to the version being encoded as a number in json files.
The fix for this is easy, however. One can either use a previous version
of sops in the range [2.0.0, 2.0.9] to edit the file, or one can manually edit
the encrypted file and change the version from a number to a string

Previously we basically hand-converted the metadata struct into a map
which we then passed to the stores. Now, we convert the metadata struct
to a "serialization" struct, which the stores serialize
2017-08-23 17:10:39 -07:00