1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 03:45:44 +01:00

73 Commits

Author SHA1 Message Date
Enbiya Göral
ab5a015436 Merge branch 'main' into feat/huaweicloud-kms 2025-12-16 23:41:37 +03:00
Alex Shearn
e50165dc41 Fix KMS encryption context not being passed when config is pre-loaded
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Alex Shearn <alex.shearn@kraken.tech>
2025-12-16 11:11:53 +00:00
Enbiya Goral
feb4f94e88 refactor: remove GetHckmsKeys() helper and use HCKms field directly
Signed-off-by: Enbiya Goral <100806254+enbiyagoral@users.noreply.github.com>
2025-12-13 23:27:37 +03:00
Enbiya Göral
f0e530b16b Update config/config.go
Co-authored-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Enbiya Göral <100806254+enbiyagoral@users.noreply.github.com>
2025-12-13 23:23:56 +03:00
Enbiya Goral
d6f36bd535 refactor: use strict []string type for HuaweiCloud KMS config
Signed-off-by: Enbiya Goral <100806254+enbiyagoral@users.noreply.github.com>
2025-12-13 23:19:07 +03:00
Enbiya Göral
d72c6edbcb Update config/config.go
Co-authored-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Enbiya Göral <100806254+enbiyagoral@users.noreply.github.com>
2025-12-13 22:48:04 +03:00
Enbiya Goral
72e903ee88 feat: Add HuaweiCloud KMS support
Signed-off-by: Enbiya Goral <100806254+enbiyagoral@users.noreply.github.com>
2025-12-12 09:41:42 +03:00
Felix Fontein
03ff3df0ef Apply review suggestions.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-09-27 20:31:50 +02:00
Felix Fontein
61cc3f79ea AZKV: Also allow to omit version for AZKV keys specified in key groups.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-09-27 20:31:50 +02:00
Felix Fontein
2420d356dd Add YAML keys for all keys in a key group.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-09-26 06:12:00 +02:00
Felix Fontein
7401cc06fc Merge branch 'main' into go.yaml.in 2025-09-08 21:02:44 +02:00
bruce-szalwinski-he
a4a8b26b47 fix: correct destination validation logic to detect all conflicts
The original validation logic used AND (&&) operators which only
detected conflicts when ALL THREE destination types were specified.
This meant invalid two-way conflicts like s3_bucket + gcs_bucket
would silently pass validation.

Fixed by implementing proper counting-based validation that rejects
any configuration with more than one destination type specified.

Added comprehensive test coverage for all conflict scenarios:
- S3 + GCS conflicts
- S3 + Vault conflicts
- GCS + Vault conflicts
- All three destinations conflicts
- Positive tests for valid single destinations

Fixes a critical configuration validation bug that could lead to
unexpected publish behavior with misconfigured .sops.yaml files.

Signed-off-by: bruce-szalwinski-he <bruce.szalwinski@hotelengine.com>
2025-09-07 14:56:58 -05: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
Lucas Earl
ce5694a128 Addressing felixfontein's latest review. Adds a key type field to the ParseKeyField fn.
Signed-off-by: Lucas Earl <earl.lucas@gmail.com>
2025-08-06 20:19:16 +02:00
Lucas Earl
b776316c39 Resolves #1864. Adds Native List as an option for configuring keys in addition to the trailing comma option already given.
Signed-off-by: Lucas Earl <earl.lucas@gmail.com>
2025-08-06 20:18:59 +02:00
Lucas Earl
6312f36bdf Resolves #1864. Adds Native List as an option for configuring keys in addition to the trailing comma option already given.
Signed-off-by: Lucas Earl <earl.lucas@gmail.com>
2025-08-06 20:18:59 +02:00
Felix Fontein
6d6e72c137 Apply suggestion by Hidde.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-03-30 17:02:33 +02:00
Felix Fontein
cbce6b47e9 Warn about .sops.yml files found while searching for .sops.yaml.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-03-30 15:21:33 +02:00
Felix Fontein
72cebfd8a1 Run 'gofmt -w' on all .go files.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-03-28 20:11:33 +01:00
Felix Fontein
89fd098763 Address review feedback, extend tests.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-01-20 19:26:43 +01:00
Felix Fontein
fae9afa607 Fix ToString for AWS KMS to include role, context, and profile.
Signed-off-by: Felix Fontein <felix@fontein.de>
2025-01-20 19:26:43 +01:00
Nicklas Frahm
22eaecad95 fix(config): remove unused variables
Signed-off-by: Nicklas Frahm <nicklas.frahm@gmail.com>
2024-12-01 21:52:55 +01:00
Jonas Badstübner
a1738b7ea7 feat(config): merge key_groups
closes #1123

Signed-off-by: Jonas Badstübner <jonas.badstuebner@hetzner-cloud.de>
2024-06-27 09:25:55 +02:00
Mitar
f63e844206 Support using comments to select parts to encrypt
Signed-off-by: Mitar <mitar.git@tnode.com>
2024-06-27 09:21:08 +02:00
Bastien
42018ef4a5 Add indentation settings for json_binary
Signed-off-by: Bastien <bastien.wermeille@gmail.com>
2023-11-24 07:41:14 +01:00
Bastien Wermeille
755c16d49c Allow no indent at all for json store
Signed-off-by: Bastien Wermeille <bastien.wermeille@gmail.com>
2023-11-24 07:41:14 +01:00
Bastien Wermeille
c6dc5267e5 Indentation of json files
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
Mitar
051ce028c9 Support computing MAC only over values which end up encrypted
Signed-off-by: Mitar <mitar.git@tnode.com>
2023-11-07 11:59:08 +01:00
Benjamin Ludewig
7ee554cb6b config: respect aws_profile from group config
Signed-off-by: Benjamin Ludewig <benjamin.ludewig@neuland-bfi.de>
2023-10-13 16:11:23 +02:00
Mitar
5f1ca1dd48 Fix descriptions of unencrypted-regex and encrypted-regex flags.
Signed-off-by: Mitar <mitar.git@tnode.com>
2023-09-22 11:48:36 +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
Cedric Kienzler
7ebee3dc7b This fixes a bug with age encryption when specifying multiple age recipients
I encountered an issue when I tried so specify multiple age recipients
in the .sops.yaml config file of my repository.

I tried running `sops --age 'agePubKey1,agePubKey2' -e -i values.secret.yaml`
which produced an appropriate file with two entries in the `/sops/age/-`
part of the encrypted yaml file.

However, I then continued to set multiple recipients in my .sops.yaml
file to simplify handling:

```yaml
creation_rules:
  - encrypted_regex: '^(data|stringData|spec)$'
    age: 'agePubKey1,agePubKey2'
```

However, this resulted in encryption only being done for the first
specified agePubKey, not the second or third one.

After digging a bit trough the code, I think this should fix it.

I verified the fix locally on my machine and got it working. Also adding
some unit tests and extending the repository examples so they can be
decrypted using the age keys provided in `age/keys.txt`

Signed-off-by: Cedric Kienzler <github@cedric-kienzler.de>
2022-03-20 22:49:11 +01:00
Paulo Lieuthier
c5b1298cd8 Match file path relative to config file's directory (2) (#853)
* Match file path relative to config file's directory

* Update README.rst
2021-04-12 13:29:06 +02:00
Adrian Utrilla
c178f89662 Revert "Match file path relative to config file's directory (#827)"
This reverts commit dd7ce3d2cb.
2021-03-10 21:47:43 +01:00
Paulo Lieuthier
dd7ce3d2cb Match file path relative to config file's directory (#827)
* Match file path relative to config file's directory

* Update README.rst

* Remove metadata field from configFile yaml-oriented struct
2021-03-10 21:37:53 +01:00
Brice Colucci
79d5dac9ff feat: Support more complicated path_regexp (issues/826) (#829)
* feat: Support more complicated path_regexp (https://github.com/mozilla/sops/issues/826)

* feat: Support more complicated path_regexp (https://github.com/mozilla/sops/issues/826)

* fix review: do not panic and return an error instead if the regexp is not valid.

* fix merge mess

Co-authored-by: AJ Bahnken <1144310+ajvb@users.noreply.github.com>
2021-03-10 21:23:11 +01: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
Cole Mickens
8f6271f5c8 age: MasterKeysFromRecipients: gracefully handle empty string 2020-09-21 12:48:16 -07:00
Cole Mickens
50a89c8293 age: .sops.yaml support 2020-09-21 12:48:16 -07:00
AJ Bahnken
bdd23ef855 Merge pull request #731 from mozilla/ajvb/fix-tests
Fix vault tests
2020-09-02 11:16:09 -07:00
AJ Bahnken
0ed7e370ac Fix vault tests 2020-09-02 10:52:20 -07:00
Rene Hernandez
8aca3cb790 Add support for --unencrypted-regex (#715)
* Add support for --unencrypted-regex

* Fix grammar mistake

* Add gofmt'd files
2020-09-02 19:15:50 +02:00
Martin Litvaj
99adfaed0b Rename LoadForFile to LoadCreationRuleForFile (#663) 2020-05-04 22:58:45 +02:00
Vaibhav Kaushik
e4abd871c7 Add HashiCorp Vault support (#655)
* feat: initial adding of vualt transit backend to sops
initial work on integration
feat(vault): added cli coomands working for vualt"

fix(vault): fixed config with correct tests

fix(vault): added vault to keygroup and to keyservice server

fixed metadata load

* feat(docs): added docs in README.md and in command help

fix(doc): fix rst formatting"

fix(doc): fix rst formatting

* fix(vault): addressed typos and fixes from autrilla

feat(cli): moved vault to hc-vault naming

* fix(test): typo while rebasing

* fix typos and imporve error messages for vault kms

* rename package from vault to hcvault

* refactor vault keysource url validation

* add negative test cases  for vault keysource

* add hc vault transit config option via objects
additional to URIs

* remove vault_example.yml

* streamline key name to snake case

* rename `BackendPath` to `EnginePath` for hc vault

* correction in hc-vault-transit commands

Signed-off-by: vnzongzna <github@vaibhavk.in>

* resolving conflict

Signed-off-by: vnzongzna <github@vaibhavk.in>

* Apply suggestions from code review

Co-Authored-By: Adrian Utrilla <adrianutrilla@gmail.com>

* allowing only hc_vault_transit_uri as input

Co-Authored-By: gitirabassi
Co-Authored-By: ldue
Signed-off-by: vnzongzna <github@vaibhavk.in>

Co-authored-by: gitirabassi <giacomo@tirabassi.eu>
Co-authored-by: ldue <larsduennwald@gmail.com>
Co-authored-by: Vaibhav Kaushik <vaibhavkaushik@vaibhavka-ltm1.internal.salesforce.com>
Co-authored-by: Adrian Utrilla <adrianutrilla@gmail.com>
2020-05-04 21:27:51 +02:00
Martin Litvaj
89d77b2082 Fix #611 - Dont break when config file exists but CreationRules are empty (#662) 2020-04-24 23:54:06 +02:00
MOREV Mikhail
ef68940d2f Add -omit-extensions option for publish subcommand 2020-01-09 11:07:28 +06:00
AJ Bahnken
8e21de8dbc Upgrade sops to go 1.13 (#566) 2019-11-18 10:06:58 -08:00
AJ Bahnken
ebf0705182 vault kv version and mount names in publish config (#513)
Adds support for publishing to vault using KV v1 and a different mount
name (or multiple).
2019-08-30 13:44:04 -07:00