Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ require (
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v0.1.1 // indirect
github.com/ory/dockertest v3.3.4+incompatible
github.com/pelletier/go-toml v1.8.2-0.20210203134853-b4f0a950bf95
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.4.2
github.com/smartystreets/goconvey v0.0.0-20190710185942-9d28bd7c0945 // indirect
Expand All @@ -48,6 +49,10 @@ require (
google.golang.org/protobuf v1.25.0
gopkg.in/ini.v1 v1.44.0
gopkg.in/urfave/cli.v1 v1.20.0
<<<<<<< HEAD
gopkg.in/yaml.v3 v3.0.0-20210107172259-749611fa9fcc
gotest.tools v2.2.0+incompatible // indirect
=======
gotest.tools v2.2.0+incompatible
>>>>>>> cc2ee88b7 (add toml store)
Comment on lines +52 to +57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge issue

)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ
github.com/ory/dockertest v3.3.4+incompatible h1:VrpM6Gqg7CrPm3bL4Wm1skO+zFWLbh7/Xb5kGEbJRh8=
github.com/ory/dockertest v3.3.4+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM=
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/pelletier/go-toml v1.8.2-0.20210129133109-c9a09d8695a8 h1:W2oirYjelH+CnTvFIwDQU+oxSNrrUt7/w7CRQ8yZokA=
github.com/pelletier/go-toml v1.8.2-0.20210129133109-c9a09d8695a8/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/pelletier/go-toml v1.8.2-0.20210203134853-b4f0a950bf95 h1:MAWl0xCdavY7sCLWqBORpL8ppvxvue1/ffgghMMVe5E=
github.com/pelletier/go-toml v1.8.2-0.20210203134853-b4f0a950bf95/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
92 changes: 46 additions & 46 deletions stores/stores.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,80 +29,80 @@ type SopsFile struct {
// in the SOPS file by checking for nil. This way we can show the user a
// helpful error message indicating that the metadata wasn't found, instead
// of showing a cryptic parsing error
Metadata *Metadata `yaml:"sops" json:"sops" ini:"sops"`
Metadata *Metadata `toml:"sops" yaml:"sops" json:"sops" ini:"sops"`
}

// Metadata is stored in SOPS encrypted files, and it contains the information necessary to decrypt the file.
// This struct is just used for serialization, and SOPS uses another struct internally, sops.Metadata. It exists
// in order to allow the binary format to stay backwards compatible over time, but at the same time allow the internal
// representation SOPS uses to change over time.
type Metadata struct {
ShamirThreshold int `yaml:"shamir_threshold,omitempty" json:"shamir_threshold,omitempty"`
KeyGroups []keygroup `yaml:"key_groups,omitempty" json:"key_groups,omitempty"`
KMSKeys []kmskey `yaml:"kms" json:"kms"`
GCPKMSKeys []gcpkmskey `yaml:"gcp_kms" json:"gcp_kms"`
AzureKeyVaultKeys []azkvkey `yaml:"azure_kv" json:"azure_kv"`
VaultKeys []vaultkey `yaml:"hc_vault" json:"hc_vault"`
AgeKeys []agekey `yaml:"age" json:"age"`
LastModified string `yaml:"lastmodified" json:"lastmodified"`
MessageAuthenticationCode string `yaml:"mac" json:"mac"`
PGPKeys []pgpkey `yaml:"pgp" json:"pgp"`
UnencryptedSuffix string `yaml:"unencrypted_suffix,omitempty" json:"unencrypted_suffix,omitempty"`
EncryptedSuffix string `yaml:"encrypted_suffix,omitempty" json:"encrypted_suffix,omitempty"`
UnencryptedRegex string `yaml:"unencrypted_regex,omitempty" json:"unencrypted_regex,omitempty"`
EncryptedRegex string `yaml:"encrypted_regex,omitempty" json:"encrypted_regex,omitempty"`
Version string `yaml:"version" json:"version"`
ShamirThreshold int `toml:"shamir_threshold,omitempty" yaml:"shamir_threshold,omitempty" json:"shamir_threshold,omitempty"`
KeyGroups []keygroup `toml:"key_groups,omitempty" yaml:"key_groups,omitempty" json:"key_groups,omitempty"`
KMSKeys []kmskey `toml:"kms" yaml:"kms" json:"kms"`
GCPKMSKeys []gcpkmskey `toml:"gcp_kms" yaml:"gcp_kms" json:"gcp_kms"`
AzureKeyVaultKeys []azkvkey `toml:"azure_kv" yaml:"azure_kv" json:"azure_kv"`
VaultKeys []vaultkey `toml:"hc_vault" yaml:"hc_vault" json:"hc_vault"`
AgeKeys []agekey `toml:"age" yaml:"age" json:"age"`
LastModified string `toml:"lastmodified" yaml:"lastmodified" json:"lastmodified"`
MessageAuthenticationCode string `toml:"mac" yaml:"mac" json:"mac"`
PGPKeys []pgpkey `toml:"pgp" yaml:"pgp" json:"pgp"`
UnencryptedSuffix string `toml:"unencrypted_suffix,omitempty" yaml:"unencrypted_suffix,omitempty" json:"unencrypted_suffix,omitempty"`
EncryptedSuffix string `toml:"encrypted_suffix,omitempty" yaml:"encrypted_suffix,omitempty" json:"encrypted_suffix,omitempty"`
UnencryptedRegex string `toml:"unencrypted_regex,omitempty" yaml:"unencrypted_regex,omitempty" json:"unencrypted_regex,omitempty"`
EncryptedRegex string `toml:"encrypted_regex,omitempty" yaml:"encrypted_regex,omitempty" json:"encrypted_regex,omitempty"`
Version string `toml:"version" yaml:"version" json:"version"`
}

type keygroup struct {
PGPKeys []pgpkey `yaml:"pgp,omitempty" json:"pgp,omitempty"`
KMSKeys []kmskey `yaml:"kms,omitempty" json:"kms,omitempty"`
GCPKMSKeys []gcpkmskey `yaml:"gcp_kms,omitempty" json:"gcp_kms,omitempty"`
AzureKeyVaultKeys []azkvkey `yaml:"azure_kv,omitempty" json:"azure_kv,omitempty"`
VaultKeys []vaultkey `yaml:"hc_vault" json:"hc_vault"`
AgeKeys []agekey `yaml:"age" json:"age"`
PGPKeys []pgpkey `toml:"pgp,omitempty" yaml:"pgp,omitempty" json:"pgp,omitempty"`
KMSKeys []kmskey `toml:"kms,omitempty" yaml:"kms,omitempty" json:"kms,omitempty"`
GCPKMSKeys []gcpkmskey `toml:"gcp_kms,omitempty" yaml:"gcp_kms,omitempty" json:"gcp_kms,omitempty"`
AzureKeyVaultKeys []azkvkey `toml:"azure_kv,omitempty" yaml:"azure_kv,omitempty" json:"azure_kv,omitempty"`
VaultKeys []vaultkey `toml:"hc_vault" yaml:"hc_vault" json:"hc_vault"`
AgeKeys []agekey `toml:"age" yaml:"age" json:"age"`
}

type pgpkey struct {
CreatedAt string `yaml:"created_at" json:"created_at"`
EncryptedDataKey string `yaml:"enc" json:"enc"`
Fingerprint string `yaml:"fp" json:"fp"`
CreatedAt string `toml:"created_at" yaml:"created_at" json:"created_at"`
EncryptedDataKey string `toml:"enc" yaml:"enc" json:"enc"`
Fingerprint string `toml:"fp" yaml:"fp" json:"fp"`
}

type kmskey struct {
Arn string `yaml:"arn" json:"arn"`
Role string `yaml:"role,omitempty" json:"role,omitempty"`
Context map[string]*string `yaml:"context,omitempty" json:"context,omitempty"`
CreatedAt string `yaml:"created_at" json:"created_at"`
EncryptedDataKey string `yaml:"enc" json:"enc"`
AwsProfile string `yaml:"aws_profile" json:"aws_profile"`
Arn string `toml:"arn" yaml:"arn" json:"arn"`
Role string `toml:"role,omitempty" yaml:"role,omitempty" json:"role,omitempty"`
Context map[string]*string `toml:"context,omitempty" yaml:"context,omitempty" json:"context,omitempty"`
CreatedAt string `toml:"created_at" yaml:"created_at" json:"created_at"`
EncryptedDataKey string `toml:"enc" yaml:"enc" json:"enc"`
AwsProfile string `toml:"aws_profile" yaml:"aws_profile" json:"aws_profile"`
}

type gcpkmskey struct {
ResourceID string `yaml:"resource_id" json:"resource_id"`
CreatedAt string `yaml:"created_at" json:"created_at"`
EncryptedDataKey string `yaml:"enc" json:"enc"`
ResourceID string `toml:"resource_id" yaml:"resource_id" json:"resource_id"`
CreatedAt string `toml:"created_at" yaml:"created_at" json:"created_at"`
EncryptedDataKey string `toml:"enc" yaml:"enc" json:"enc"`
}

type vaultkey struct {
VaultAddress string `yaml:"vault_address" json:"vault_address"`
EnginePath string `yaml:"engine_path" json:"engine_path"`
KeyName string `yaml:"key_name" json:"key_name"`
CreatedAt string `yaml:"created_at" json:"created_at"`
EncryptedDataKey string `yaml:"enc" json:"enc"`
VaultAddress string `toml:"vault_address" yaml:"vault_address" json:"vault_address"`
EnginePath string `toml:"engine_path" yaml:"engine_path" json:"engine_path"`
KeyName string `toml:"key_name" yaml:"key_name" json:"key_name"`
CreatedAt string `toml:"created_at" yaml:"created_at" json:"created_at"`
EncryptedDataKey string `toml:"enc" yaml:"enc" json:"enc"`
}

type azkvkey struct {
VaultURL string `yaml:"vault_url" json:"vault_url"`
Name string `yaml:"name" json:"name"`
Version string `yaml:"version" json:"version"`
CreatedAt string `yaml:"created_at" json:"created_at"`
EncryptedDataKey string `yaml:"enc" json:"enc"`
VaultURL string `toml:"vault_url" yaml:"vault_url" json:"vault_url"`
Name string `toml:"name" yaml:"name" json:"name"`
Version string `toml:"version" yaml:"version" json:"version"`
CreatedAt string `toml:"created_at" yaml:"created_at" json:"created_at"`
EncryptedDataKey string `toml:"enc" yaml:"enc" json:"enc"`
}

type agekey struct {
Recipient string `yaml:"recipient" json:"recipient"`
EncryptedDataKey string `yaml:"enc" json:"enc"`
Recipient string `toml:"recipient" yaml:"recipient" json:"recipient"`
EncryptedDataKey string `toml:"enc" yaml:"enc" json:"enc"`
}

// MetadataFromInternal converts an internal SOPS metadata representation to a representation appropriate for storage
Expand Down
Loading