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.
先审查再安装
这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。
npx -y tokrepo@latest install f8f53103-3712-11f1-9bc6-00163e2b0d79 --target codex先 dry-run,确认写入项后再运行此命令。
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.
常见问题
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.
引用来源 (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
讨论
相关资产
MobX — Simple Scalable State Management for JavaScript
MobX is a transparent reactive state management library that makes state management simple and scalable by applying functional reactive programming principles to JavaScript and TypeScript applications.
Wagtail — The Flexible Django Content Management System
Wagtail is an open-source CMS built on Django that gives developers full control over frontend design while providing editors with an intuitive page-editing interface.
Jotai — Primitive and Flexible State Management for React
Jotai is an atomic state library for React. You compose atoms like React useState, and Jotai handles subscription, derivation, and async loading — all without the boilerplate of Redux or the global store of Zustand.
Valtio — Proxy-Based State Management for React
Valtio makes React state management simple by wrapping plain JavaScript objects in a proxy, so components automatically re-render when the properties they read change — no reducers, actions, or boilerplate required.