Граф коммитов

11 Коммитов

Автор SHA1 Сообщение Дата
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
Hidde Beydals 4f858e5ed2 azkv: update Azure SDK to v0.9.0
Besides some signature changes, really nothing special.

```
$ go test --tags integration ./... -v
=== RUN   TestMasterKey_Encrypt
--- PASS: TestMasterKey_Encrypt (1.34s)
=== RUN   TestMasterKey_Decrypt
--- PASS: TestMasterKey_Decrypt (0.68s)
=== RUN   TestMasterKey_EncryptDecrypt_RoundTrip
--- PASS: TestMasterKey_EncryptDecrypt_RoundTrip (0.40s)
=== RUN   TestNewMasterKeyFromURL
=== RUN   TestNewMasterKeyFromURL/URL
=== RUN   TestNewMasterKeyFromURL/malformed_URL
--- PASS: TestNewMasterKeyFromURL (0.00s)
    --- PASS: TestNewMasterKeyFromURL/URL (0.00s)
    --- PASS: TestNewMasterKeyFromURL/malformed_URL (0.00s)
=== RUN   TestMasterKeysFromURLs
=== RUN   TestMasterKeysFromURLs/single_URL
=== RUN   TestMasterKeysFromURLs/multiple_URLs
=== RUN   TestMasterKeysFromURLs/multiple_URLs,_one_malformed
=== RUN   TestMasterKeysFromURLs/empty
--- PASS: TestMasterKeysFromURLs (0.00s)
    --- PASS: TestMasterKeysFromURLs/single_URL (0.00s)
    --- PASS: TestMasterKeysFromURLs/multiple_URLs (0.00s)
    --- PASS: TestMasterKeysFromURLs/multiple_URLs,_one_malformed (0.00s)
    --- PASS: TestMasterKeysFromURLs/empty (0.00s)
=== RUN   TestTokenCredential_ApplyToMasterKey
--- PASS: TestTokenCredential_ApplyToMasterKey (0.00s)
=== RUN   TestMasterKey_EncryptedDataKey
--- PASS: TestMasterKey_EncryptedDataKey (0.00s)
=== RUN   TestMasterKey_SetEncryptedDataKey
--- PASS: TestMasterKey_SetEncryptedDataKey (0.00s)
=== RUN   TestMasterKey_EncryptIfNeeded
=== RUN   TestMasterKey_EncryptIfNeeded/not_encrypted
[AZKV]   time="2022-11-21T20:41:58Z" level=error msg="Encryption failed" key=test-key version=a2a690a4fcc04166b739da342a912c90
=== RUN   TestMasterKey_EncryptIfNeeded/already_encrypted
--- PASS: TestMasterKey_EncryptIfNeeded (2.12s)
    --- PASS: TestMasterKey_EncryptIfNeeded/not_encrypted (2.12s)
    --- PASS: TestMasterKey_EncryptIfNeeded/already_encrypted (0.00s)
=== RUN   TestMasterKey_NeedsRotation
--- PASS: TestMasterKey_NeedsRotation (0.00s)
=== RUN   TestMasterKey_ToString
--- PASS: TestMasterKey_ToString (0.00s)
=== RUN   TestMasterKey_ToMap
--- PASS: TestMasterKey_ToMap (0.00s)
=== RUN   TestMasterKey_getTokenCredential
=== RUN   TestMasterKey_getTokenCredential/with_TokenCredential
=== RUN   TestMasterKey_getTokenCredential/default
--- PASS: TestMasterKey_getTokenCredential (0.00s)
    --- PASS: TestMasterKey_getTokenCredential/with_TokenCredential (0.00s)
    --- PASS: TestMasterKey_getTokenCredential/default (0.00s)
PASS
ok      go.mozilla.org/sops/v3/azkv     4.551s
```

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-07-03 21:34:58 +02:00
Hidde Beydals ce5177651b azkv: update Azure SDK to v0.6.0
This should be the last major change in their SDK with regard to
changing method signatures and/or the way the client is constructed.

I manually ran the integration test suite which passes without any
issues.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-07-03 21:34:58 +02:00
Hidde Beydals b80c0d1eba azkv: update SDK to latest, add tests, tidy
This updates the Azure SDK to latest[1], while dropping the custom
authentication flow in favor of the SDK default[2]. It includes
integration tests, which require the `integration` Go build tag and
a set of environmental variables to be configured to be run:

```
PASS
coverage: 81.2% of statements
ok  	go.mozilla.org/sops/v3/azkv	5.376s	coverage: 81.2% of statements
```

The improvements are based on a fork of the key source in the Flux
project's kustomize-controller, built due to SOPS' limitation around
credential managment without relying on runtime environment variables.

- Azure SDK has been updated to latest, including integration test
  coverage.
- Custom authentication flow has been dropped in favor of the SDK
  default[2]. This should work well on almost any system and is
  generally the go-to way of setting this up, including on cloud
  environments, etc.
- It introduces a `TokenCredential` type which holds an
  `azcore.TokenCredential`, and can be applied to a `MasterKey`.
  When applied, the token is used instead of the SDK default. This is
  most useful when working with SOPS as an SDK, in combination with
  e.g. a local key service server implementation.
- Extensive test coverage.

The forked version of this has compatibility tests to ensure it works
with current SOPS:

- 327a3560b3/internal/sops/azkv/keysource_integration_test.go (L89)
- 327a3560b3/internal/sops/azkv/keysource_integration_test.go (L117)

[1]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/keyvault/azkeys
[2]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity#DefaultAzureCredential

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-06-02 22:26:07 +02:00
Mikhail Katychev 0f2ebcf7ff
added wrap verb to outputs (#817) 2021-02-17 22:21:20 +01:00
AJ Bahnken 8e21de8dbc
Upgrade sops to go 1.13 (#566) 2019-11-18 10:06:58 -08:00
Aaron Wislang 862a9dc372 Add MSI_ENDPOINT variable. Handle "devicecode" case. 2019-07-17 12:43:42 +02:00
Aaron Wislang c181d95ed8 Adds new Azure authentication methods via newAuthorizer() 2019-07-17 12:43:42 +02:00
Adriano 4b99fa18b3
go lint 2019-07-11 10:30:32 -07:00
Calle Pettersson 19e964ebdd Make Azure key parsing failable 2018-06-18 16:03:24 +02:00
Calle Pettersson 9fa4f0e90e Add support for Azure Key Vault 2018-06-17 22:50:30 +02:00