How getsops/sops works
SOPS is a command-line editor for structured files whose values and data key are encrypted. The main workflow selects a file format and configuration, operates on the encrypted tree, and uses configured master keys to protect or recover the data key. The repository also provides a remote gRPC key service and publishing commands. The graph captures documented format and key-provider support; some CLI handlers and provider implementations were not sampled, so their detailed runtime links are omitted.
Main entry points: config.go Configuration · server.go gRPC key server · common.go CLI operations · stores.go SOPS metadata
Components 24
CLI workflow
- SOPS CLI
cmd/sops/main.go - CLI operations
cmd/sops/common/common.go - Configuration
config/config.go
Encryption core
- Encrypted tree
sops.go - Value cipher
aes/cipher.go - Audit logging
audit/audit.go
File formats
- SOPS metadata
stores/stores.go - YAML store
stores/yaml/store.go - JSON and binary
stores/json/store.go - ENV store
stores/dotenv/store.go - INI store
stores/ini/store.go
Key management
- Key service API
keyservice/keyservice.go - gRPC key server
keyservice/server.go - AWS KMS
kms/keysource.go - GCP KMS
gcpkms/keysource.go - Azure Key Vault
azkv/keysource.go - Huawei KMS
hckms/keysource.go - Vault Transit
hcvault/keysource.go - age keys
age/keysource.go - PGP keys
pgp/keysource.go
Publishing and service
- Publish command
cmd/sops/subcommand/publish/publish.go - Publish targets
publish/publish.go - Service command
cmd/sops/subcommand/keyservice/keyservice.go
Other components
- Operator
Connections 31
- Operator → SOPS CLI: runs commands
- SOPS CLI → CLI operations: uses operations
cmd/sops/main.go - CLI operations → Configuration: reads settings
cmd/sops/common/common.go - CLI operations → YAML store: selects store
cmd/sops/common/common.go - CLI operations → JSON and binary: selects store
cmd/sops/common/common.go - CLI operations → ENV store: selects store
cmd/sops/common/common.go - CLI operations → INI store: selects store
cmd/sops/common/common.go - SOPS metadata → YAML store: serializes metadata
stores/yaml/store.go - SOPS metadata → JSON and binary: serializes metadata
stores/json/store.go - SOPS metadata → ENV store: serializes metadata
stores/dotenv/store.go - SOPS metadata → INI store: serializes metadata
stores/ini/store.go - Encrypted tree → Key service API: protects data key
sops.go - Encrypted tree → Value cipher: encrypts values
sops.go - Encrypted tree → Audit logging: records events
sops.go - gRPC key server → AWS KMS: dispatches key ops
keyservice/server.go - gRPC key server → GCP KMS: dispatches key ops
keyservice/server.go - gRPC key server → Azure Key Vault: dispatches key ops
keyservice/server.go - gRPC key server → Huawei KMS: dispatches key ops
keyservice/server.go - gRPC key server → Vault Transit: dispatches key ops
keyservice/server.go - gRPC key server → age keys: dispatches key ops
keyservice/server.go - gRPC key server → PGP keys: dispatches key ops
keyservice/server.go - Service command → gRPC key server: registers server
cmd/sops/subcommand/keyservice/keyservice.go - SOPS CLI → Publish command: invokes command
cmd/sops/main.go - Publish command → Publish targets: publishes output
cmd/sops/subcommand/publish/publish.go - Configuration → AWS KMS: configures keys
config/config.go - Configuration → GCP KMS: configures keys
config/config.go - Configuration → Azure Key Vault: configures keys
config/config.go - Configuration → Huawei KMS: configures keys
config/config.go - Configuration → Vault Transit: configures keys
config/config.go - Configuration → age keys: configures keys
config/config.go - Configuration → PGP keys: configures keys
config/config.go