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>
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>
Makes sure that the 'data' key refers to strings. Also
improves error messages, and on CLI hints at the --output-type
option.
Signed-off-by: Felix Fontein <felix@fontein.de>
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>
Add support for decoding JSON arrays of arrays by handling, during
slice decoding, when the next token is an array opening. This produces
nested []interface{} slices.
Closes #640.
* Handle escaping in original json
* Replace conditional magic with proper json encoding call for key
* swap TestDecodeJSONWithEscaping with new TestEncodeJSONWithEscaping
* fix copy/paste typo
* 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
**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