Skill v1.0.1
currentAutomated scan100/100+3 new, ~2 modified, -1 removed
version: "1.0.1" name: sops-secrets description: "Encrypt, rotate, and inject Git secrets with sops and age." license: MIT metadata: kind: task author: Médéric HURIER (Fmind) source: github.com/fmind/dot/tree/main/skills/sops-secrets created: "2026-08-07" updated: "2026-10-16"
Secrets with sops and age
Encrypted secrets live in git next to their configuration. Use environment variables or FIFOs for runtime delivery; interactive editing can write temporary plaintext. gitleaks scans for leaked credentials, and cloud-run owns runtime Secret Manager integration.
Model
- age provides the key pair: one private key per machine or human, public recipients everywhere; prefer it for solo use. Choose cloud KMS when centrally managed access is required; adding a KMS recipient alongside age does not revoke the independent age decryption path.
- Name encrypted files `*.enc.*`: encrypted files are committed as
*.enc.yaml,*.enc.json, or*.enc.env; sops.yaml keys its rules off that suffix and plaintext siblings stay gitignored. - Declare encryption policy in `.sops.yaml`:
.sops.yamlat the repo root (sops.yaml) declares which paths get encrypted and for which recipients, so no ad-hoc flags are needed.
Keys
Before the first encryption on a machine, and for any recipient change, follow key-lifecycle: preserve an existing SOPS_AGE_KEY_FILE or key, generate only when absent, distribute only public recipients, back up the private key outside Git, and rotate through updatekeys plus rotate.
Commands
sops edit secrets.enc.yaml # create or edit: decrypts to $EDITOR, re-encrypts on savesops encrypt --filename-override config.enc.yaml --output config.enc.yaml config.yaml # suffix selects the rule; --output preserves prior ciphertext if encryption failssops exec-env secrets.enc.env 'mise run watch' # inject as env vars, memory-only (preferred)sops exec-file secrets.enc.json 'tool --config {}' # Unix tools get a FIFO by default, not a tmpfs guarantee
- Prefer `exec-env` and `exec-file` for runtime delivery; keep values out of logs and inspect how child processes handle them.
--no-fifowrites a regular temporary file. - Pipe decryption only to a reviewed consumer: bare
sops decryptprints plaintext secrets into captured output. Never display its stdout or redirect it to a plaintext file. - Wire integrations from their guide: read integrations.md before wiring CI decryption (age key versus
gcp_kmsthrough Workload Identity Federation), Flux, OpenTofu, or a runtime secret manager.
Gotchas
- Editing writes temporary plaintext:
sops editwrites a temporary plaintext file for the editor. When disk plaintext is forbidden, use an explicitly configured memory-backed temporary directory and compatible editor settings, or avoid the editor workflow. - Encryption cannot revoke past copies: encryption does not erase the input, editor backups, shell history, or past commits. Removing a recipient and rotating the SOPS data key protects the new file, but cannot revoke copies or older Git revisions that recipient could decrypt. Rotate exposed application credentials at their provider within the authorized scope.
- Key names still leak: sops encrypts values, not keys, so
stripe_production_key:in a public repo is information; name keys neutrally when the repo is public. - Never edit ciphertext by hand: sops stores a MAC over the file and out-of-band edits fail decryption; go through
sops editorsops set. - Rule match is positional:
sops editpicks the firstcreation_rulesentry whosepath_regexmatches the path relative to.sops.yaml, so run sops from the repo root, and runupdatekeysafter any recipient change. - Inspect every gitleaks finding: the lefthook pre-commit scans the working tree, catching a plaintext sibling of an
*.enc.*file. Inspect the redacted rule and location for every finding, including*.enc.*files; the suffix does not prove that comments, keys, or excluded fields are encrypted. Confirm whether plaintext was exposed before rotating credentials per gitleaks.
Task guides
<!-- guides:start -->
- key-lifecycle: Resolve, generate, distribute, back up, and rotate age keys and sops recipients.
<!-- guides:end -->
Documentation
- sops · key management · age
- Releases: sops · age
- Companion skills: gitleaks, lefthook, cloud-run (runtime secrets), infra-as-code, code-security.