Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
34d2349
feat: OCI KMS provider
deblasis Dec 28, 2024
c3e6f58
Merge branch 'main' into issue/#981-oci-kms
deblasis Dec 31, 2024
7c4db9e
docs: rstcheck fix
deblasis Dec 31, 2024
953741a
Merge branch 'main' into issue/#981-oci-kms
deblasis Dec 31, 2024
6407abc
Merge branch 'main' of github.com:mozilla/sops into issue/#981-oci-kms
deblasis Jan 8, 2025
af6fbba
Merge branch 'main' of github.com:mozilla/sops into issue/#981-oci-kms
deblasis Jan 8, 2025
d50b1fb
Merge branch 'main' into issue/#981-oci-kms
deblasis Jan 21, 2025
b3101d9
Merge branch 'main' into issue/#981-oci-kms
deblasis Feb 7, 2025
efadca1
Merge branch 'issue/#981-oci-kms' of github.com:deblasis/sops into is…
deblasis Sep 26, 2025
2f1e5ea
Merge branch 'master' into issue/#981-oci-kms
deblasis Sep 26, 2025
cbb86a1
build(deps): Update oci-go-sdk to v65.101.0
deblasis Sep 26, 2025
47aa92e
feat(oci): Add OCI CLI environment provider and related tests
deblasis Sep 26, 2025
8aabc43
docs: Update README with OCI KMS authentication details and examples
deblasis Sep 26, 2025
6c95753
Merge remote-tracking branch 'origin/master' into issue/#981-oci-kms
deblasis Sep 26, 2025
c04cbd9
chore(go): Update Go version to 1.24.0 and specify toolchain version
deblasis Sep 26, 2025
2211160
Merge remote-tracking branch 'origin/master' into issue/#981-oci-kms
deblasis Sep 28, 2025
1a743ee
Merge branch 'main' into issue/#981-oci-kms
deblasis Sep 29, 2025
936aa3e
Merge branch 'main' into issue/#981-oci-kms
deblasis Sep 30, 2025
e26b4b7
use StringToRegion and EndpointForTemplate to create the crypto endpoint
b-dean Sep 30, 2025
0d83e29
Merge branch 'issue/#981-oci-kms' of github.com:deblasis/sops into is…
deblasis Oct 1, 2025
4e025d8
feat: add early exit optimization for Instance Principal in configura…
deblasis Oct 3, 2025
a6df587
feat: implement lazy initialization for ConfigurationProvider
deblasis Oct 4, 2025
05b1641
Merge branch 'main' into issue/#981-oci-kms
deblasis Oct 7, 2025
5aefd26
Merge remote-tracking branch 'upstream/main' into issue/#981-oci-kms
deblasis Jun 17, 2026
991fcf7
docs: add Oracle Cloud KMS to the supported providers list
deblasis Jun 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/
dist/
functional-tests/sops
functional-tests/target
vendor/
profile.out
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SOPS: Secrets OPerationS
========================

**SOPS** is an editor of encrypted files that supports YAML, JSON, ENV, INI and BINARY
formats and encrypts with AWS KMS, GCP KMS, Azure Key Vault, HuaweiCloud KMS, age, and PGP.
formats and encrypts with AWS KMS, GCP KMS, Azure Key Vault, HuaweiCloud KMS, Oracle Cloud KMS, age, and PGP.
(`demo <https://www.youtube.com/watch?v=YTEVyLXFiq0>`_)

.. image:: https://i.imgur.com/X0TM5NI.gif
Expand Down
36 changes: 30 additions & 6 deletions cmd/sops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"github.com/getsops/sops/v3/keyservice"
"github.com/getsops/sops/v3/kms"
"github.com/getsops/sops/v3/logging"
"github.com/getsops/sops/v3/ocikms"
"github.com/getsops/sops/v3/pgp"
"github.com/getsops/sops/v3/stores"
"github.com/getsops/sops/v3/stores/dotenv"
Expand Down Expand Up @@ -1209,8 +1210,8 @@ func main() {
return toExitError(err)
}
if _, err := os.Stat(fileName); os.IsNotExist(err) {
if c.String("add-kms") != "" || c.String("add-pgp") != "" || c.String("add-gcp-kms") != "" || c.String("add-hckms") != "" || c.String("add-hc-vault-transit") != "" || c.String("add-azure-kv") != "" || c.String("add-age") != "" ||
c.String("rm-kms") != "" || c.String("rm-pgp") != "" || c.String("rm-gcp-kms") != "" || c.String("rm-hckms") != "" || c.String("rm-hc-vault-transit") != "" || c.String("rm-azure-kv") != "" || c.String("rm-age") != "" {
if c.String("add-kms") != "" || c.String("add-pgp") != "" || c.String("add-gcp-kms") != "" || c.String("add-hckms") != "" || c.String("add-hc-vault-transit") != "" || c.String("add-azure-kv") != "" || c.String("add-age") != "" || c.String("add-oci-kms") != "" ||
c.String("rm-kms") != "" || c.String("rm-pgp") != "" || c.String("rm-gcp-kms") != "" || c.String("rm-hckms") != "" || c.String("rm-hc-vault-transit") != "" || c.String("rm-azure-kv") != "" || c.String("rm-age") != "" || c.String("rm-oci-kms") != "" {
return common.NewExitError(fmt.Sprintf("Error: cannot add or remove keys on non-existent file %q, use the `edit` subcommand instead.", fileName), codes.CannotChangeKeysFromNonExistentFile)
}
}
Expand Down Expand Up @@ -1734,6 +1735,11 @@ func main() {
Usage: "comma separated list of age recipients",
EnvVar: "SOPS_AGE_RECIPIENTS",
},
cli.StringFlag{
Name: "oci-kms",
Usage: "comma separated list of OCI KMS OCIDs",
EnvVar: "SOPS_OCI_KMS_OCIDS",
},
cli.BoolFlag{
Name: "in-place, i",
Usage: "write output back to the same file instead of stdout",
Expand Down Expand Up @@ -1802,6 +1808,14 @@ func main() {
Name: "rm-age",
Usage: "remove the provided comma-separated list of age recipients from the list of master keys on the given file",
},
cli.StringFlag{
Name: "add-oci-kms",
Usage: "add the provided comma-separated list of OCI KMS keys OCIDs to the list of master keys on the given file",
},
cli.StringFlag{
Name: "rm-oci-kms",
Usage: "remove the provided comma-separated list of OCI KMS keys OCIDs from the list of master keys on the given file",
},
cli.StringFlag{
Name: "add-pgp",
Usage: "add the provided comma-separated list of PGP fingerprints to the list of master keys on the given file",
Expand Down Expand Up @@ -2235,7 +2249,7 @@ func getEncryptConfig(c *cli.Context, fileName string, inputStore common.Store,
}, nil
}

func getMasterKeys(c *cli.Context, kmsEncryptionContext map[string]*string, kmsOptionName string, pgpOptionName string, gcpKmsOptionName string, hckmsOptionName string, azureKvOptionName string, hcVaultTransitOptionName string, ageOptionName string) ([]keys.MasterKey, error) {
func getMasterKeys(c *cli.Context, kmsEncryptionContext map[string]*string, kmsOptionName string, pgpOptionName string, gcpKmsOptionName string, hckmsOptionName string, azureKvOptionName string, hcVaultTransitOptionName string, ageOptionName string, ociOptionName string) ([]keys.MasterKey, error) {
var masterKeys []keys.MasterKey
for _, k := range kms.MasterKeysFromArnString(c.String(kmsOptionName), kmsEncryptionContext, c.String("aws-profile")) {
masterKeys = append(masterKeys, k)
Expand Down Expand Up @@ -2274,16 +2288,19 @@ func getMasterKeys(c *cli.Context, kmsEncryptionContext map[string]*string, kmsO
for _, k := range ageKeys {
masterKeys = append(masterKeys, k)
}
for _, k := range ocikms.MasterKeysFromOCIDString(c.String(ociOptionName)) {
masterKeys = append(masterKeys, k)
}
return masterKeys, nil
}

func getRotateOpts(c *cli.Context, fileName string, inputStore common.Store, outputStore common.Store, svcs []keyservice.KeyServiceClient, decryptionOrder []string) (rotateOpts, error) {
kmsEncryptionContext := kms.ParseKMSContext(c.String("encryption-context"))
addMasterKeys, err := getMasterKeys(c, kmsEncryptionContext, "add-kms", "add-pgp", "add-gcp-kms", "add-hckms", "add-azure-kv", "add-hc-vault-transit", "add-age")
addMasterKeys, err := getMasterKeys(c, kmsEncryptionContext, "add-kms", "add-pgp", "add-gcp-kms", "add-hckms", "add-azure-kv", "add-hc-vault-transit", "add-age", "add-oci-kms")
if err != nil {
return rotateOpts{}, err
}
rmMasterKeys, err := getMasterKeys(c, kmsEncryptionContext, "rm-kms", "rm-pgp", "rm-gcp-kms", "rm-hckms", "rm-azure-kv", "rm-hc-vault-transit", "rm-age")
rmMasterKeys, err := getMasterKeys(c, kmsEncryptionContext, "rm-kms", "rm-pgp", "rm-gcp-kms", "rm-hckms", "rm-azure-kv", "rm-hc-vault-transit", "rm-age", "rm-oci-kms")
if err != nil {
return rotateOpts{}, err
}
Expand Down Expand Up @@ -2433,6 +2450,7 @@ func keyGroups(c *cli.Context, file string, optionalConfig *config.Config) ([]so
var hcVaultMkKeys []keys.MasterKey
var hckmsMkKeys []keys.MasterKey
var ageMasterKeys []keys.MasterKey
var ociMasterKeys []keys.MasterKey
kmsEncryptionContext := kms.ParseKMSContext(c.String("encryption-context"))
if c.String("encryption-context") != "" && kmsEncryptionContext == nil {
return nil, common.NewExitError("Invalid KMS encryption context format", codes.ErrorInvalidKMSEncryptionContextFormat)
Expand Down Expand Up @@ -2488,7 +2506,12 @@ func keyGroups(c *cli.Context, file string, optionalConfig *config.Config) ([]so
ageMasterKeys = append(ageMasterKeys, k)
}
}
if c.String("kms") == "" && c.String("pgp") == "" && c.String("gcp-kms") == "" && c.String("hckms") == "" && c.String("azure-kv") == "" && c.String("hc-vault-transit") == "" && c.String("age") == "" {
if c.String("oci-kms") != "" {
for _, k := range ocikms.MasterKeysFromOCIDString(c.String("oci-kms")) {
ociMasterKeys = append(ociMasterKeys, k)
}
}
if c.String("kms") == "" && c.String("pgp") == "" && c.String("gcp-kms") == "" && c.String("hckms") == "" && c.String("azure-kv") == "" && c.String("hc-vault-transit") == "" && c.String("age") == "" && c.String("oci-kms") == "" {
conf := optionalConfig
var err error
if conf == nil {
Expand All @@ -2512,6 +2535,7 @@ func keyGroups(c *cli.Context, file string, optionalConfig *config.Config) ([]so
group = append(group, pgpKeys...)
group = append(group, hcVaultMkKeys...)
group = append(group, ageMasterKeys...)
group = append(group, ociMasterKeys...)
log.Debugf("Master keys available: %+v", group)
return []sops.KeyGroup{group}, nil
}
Expand Down
12 changes: 12 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/getsops/sops/v3/hckms"
"github.com/getsops/sops/v3/hcvault"
"github.com/getsops/sops/v3/kms"
"github.com/getsops/sops/v3/ocikms"
"github.com/getsops/sops/v3/pgp"
"github.com/getsops/sops/v3/publish"
"go.yaml.in/yaml/v3"
Expand Down Expand Up @@ -137,6 +138,7 @@ type keyGroup struct {
AzureKV []azureKVKey `yaml:"azure_keyvault"`
Vault []string `yaml:"hc_vault"`
Age []string `yaml:"age"`
OCIKMS []string `yaml:"oci_kms"`
PGP []string `yaml:"pgp"`
}

Expand Down Expand Up @@ -179,6 +181,7 @@ type creationRule struct {
PathRegex string `yaml:"path_regex"`
KMS interface{} `yaml:"kms"` // string or []string
AwsProfile string `yaml:"aws_profile"`
OCIKMS string `yaml:"oci_kms"`
Age interface{} `yaml:"age"` // string or []string
PGP interface{} `yaml:"pgp"` // string or []string
GCPKMS interface{} `yaml:"gcp_kms"` // string or []string
Expand Down Expand Up @@ -327,6 +330,9 @@ func extractMasterKeys(group keyGroup) (sops.KeyGroup, error) {
keyGroup = append(keyGroup, key)
}
}
for _, k := range group.OCIKMS {
keyGroup = append(keyGroup, ocikms.NewMasterKeyFromOCID(k))
}
for _, k := range group.PGP {
keyGroup = append(keyGroup, pgp.NewMasterKeyFromFingerprint(k))
}
Expand Down Expand Up @@ -376,6 +382,9 @@ func getKeyGroupsFromCreationRule(cRule *creationRule, kmsEncryptionContext map[
if err != nil {
return nil, err
}
for _, k := range group.OCIKMS {
keyGroup = append(keyGroup, ocikms.NewMasterKeyFromOCID(k))
}
groups = append(groups, keyGroup)
}
} else {
Expand Down Expand Up @@ -423,6 +432,9 @@ func getKeyGroupsFromCreationRule(cRule *creationRule, kmsEncryptionContext map[
for _, k := range hckmsMasterKeys {
keyGroup = append(keyGroup, k)
}
for _, k := range ocikms.MasterKeysFromOCIDString(cRule.OCIKMS) {
keyGroup = append(keyGroup, k)
}
azKeys, err := getKeysWithValidation(cRule.GetAzureKeyVaultKeys, "azure_keyvault")
if err != nil {
return nil, err
Expand Down
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ require (
github.com/lib/pq v1.12.3
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-wordwrap v1.0.1
github.com/ontariosystems/oci-cli-env-provider v0.1.0
github.com/oracle/oci-go-sdk/v65 v65.101.0
github.com/ory/dockertest/v3 v3.12.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.4
Expand Down Expand Up @@ -102,6 +104,7 @@ require (
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
Expand Down Expand Up @@ -135,11 +138,13 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sony/gobreaker v1.0.0 // indirect
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
github.com/tjfoc/gmsm v1.4.1 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
go.mongodb.org/mongo-driver v1.17.9 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.43.0 // indirect
Expand Down
Loading