sops — Simple and Flexible Secrets Management
sops (Secrets OPerationS) encrypts values in YAML, JSON, ENV, and INI files while keeping keys in plaintext. This lets you version-control encrypted secrets in Git, using age, AWS KMS, GCP KMS, Azure Key Vault, or PGP as encryption backends.
What it is
sops (Secrets OPerationS) is a CLI tool that encrypts values in YAML, JSON, ENV, and INI files while keeping keys in plaintext. This design lets you version-control encrypted secrets in Git because diffs show which keys changed without exposing values. sops supports multiple encryption backends: age, AWS KMS, GCP KMS, Azure Key Vault, and HashiCorp Vault.
sops is for DevOps engineers and platform teams who need to store secrets alongside application code in Git without exposing sensitive values.
The project is actively maintained with regular releases and a growing user community. Documentation covers common use cases, and the open-source nature means you can inspect the source code, contribute fixes, and adapt the tool to your specific requirements.
How it saves time or tokens
Without sops, secrets live in separate vaults, environment variables, or sealed-secrets controllers. Each approach fragments configuration across multiple systems. sops keeps secrets in the same YAML files as other configuration, encrypted in place. You edit secrets with sops edit, commit the encrypted file, and decrypt at deploy time.
How to use
- Install sops via brew or download the binary.
- Create a
.sops.yamlfile specifying your encryption keys. - Run
sops encryptto encrypt a file orsops editto edit secrets in your default editor.
Example
# Install sops
brew install sops
# Generate an age key
age-keygen -o key.txt
export SOPS_AGE_KEY_FILE=key.txt
# Create .sops.yaml config
cat > .sops.yaml << 'EOF'
creation_rules:
- path_regex: secrets\.yaml$
age: 'age1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
EOF
# Encrypt a secrets file
sops encrypt secrets.yaml > secrets.enc.yaml
# Edit encrypted secrets (decrypts in editor, re-encrypts on save)
sops edit secrets.enc.yaml
# Decrypt for deployment
sops decrypt secrets.enc.yaml > secrets.yaml
Related on TokRepo
- AI Tools for Security -- Secrets management and security tools
- AI Tools for DevOps -- Infrastructure and deployment tools
Common pitfalls
- Committing the unencrypted secrets file to Git by mistake. Add the unencrypted filename to
.gitignoreand only commit the.enc.yamlversion. - Losing the encryption key means permanent loss of all encrypted secrets. Back up age keys or use a managed KMS service with key rotation.
- sops encrypts values but not keys. Secret names (database_password, api_key) are visible in the encrypted file. Avoid putting sensitive information in key names.
Before adopting this tool, evaluate whether it fits your team's existing workflow. Read the official documentation thoroughly, and start with a small proof-of-concept rather than a full migration. Community forums, GitHub issues, and Stack Overflow are valuable resources when you encounter edge cases not covered in the documentation.
Frequently Asked Questions
sops supports age, AWS KMS, GCP KMS, Azure Key Vault, HashiCorp Vault, and PGP. You can use multiple backends simultaneously for the same file, enabling key sharing across teams and cloud providers.
Vault is a centralized secrets management service with access control, audit logging, and dynamic secrets. sops is a file-level encryption tool that stores encrypted secrets in Git. They serve different use cases and can be used together.
Yes. sops supports encrypted_regex and encrypted_suffix rules in .sops.yaml to encrypt only fields matching a pattern. This lets you keep non-sensitive values in plaintext for easier review.
Yes. Encrypt Kubernetes Secret manifests with sops and decrypt them during deployment with tools like Flux, ArgoCD, or Helm Secrets. The encrypted manifests are safe to store in Git.
age is a modern, simple file encryption tool designed as a replacement for PGP. It is the recommended backend for sops when you do not need cloud KMS integration. age keys are small, easy to manage, and have no configuration complexity.
Citations (3)
- sops GitHub— sops encrypts values in YAML, JSON, ENV, and INI files
- sops README— Supports age, AWS KMS, GCP KMS, Azure Key Vault
- age GitHub— age is a simple modern encryption tool
Related on TokRepo
Discussion
Related Assets
NAPI-RS — Build Node.js Native Addons in Rust
Write high-performance Node.js native modules in Rust with automatic TypeScript type generation and cross-platform prebuilt binaries.
Mamba — Fast Cross-Platform Package Manager
A drop-in conda replacement written in C++ that resolves environments in seconds instead of minutes.
Plasmo — The Browser Extension Framework
Build, test, and publish browser extensions for Chrome, Firefox, and Edge using React or Vue with hot-reload and automatic manifest generation.