Repository navigation
cmd secrets
Moved to
nself config secretsin v1.5.0, removed in v1.6.0. The old spelling keeps working until then.
See cmd-config for the current command. Command-Canon lists every move.
Manage encrypted project secrets (age encryption).
nself secrets manages per-environment encrypted secrets using age encryption. Secrets are stored as age-encrypted JSON files under .secrets/ (one file per environment). Each team member holds an age keypair; secrets are encrypted to all team members' public keys, so anyone with a valid private key can decrypt without a shared password.
The persistent --env flag selects which environment a subcommand operates on (default dev). secrets init generates the local age keypair and .secrets/ skeleton. secrets set / get / list / edit are the day-to-day operations. secrets rotate rolls a value, with --dual-window to keep _PREVIOUS alongside _CURRENT for a transition window; secrets retire removes the _PREVIOUS half once the rotation has settled.
secrets schedule shows the rotation schedule status for tracked secrets. secrets audit lists secrets older than the rotation policy. secrets lint greps git-tracked files for plaintext secrets. secrets decrypt-on-deploy outputs KEY=VALUE lines for CI/CD consumption. In v1.5 it prints the plaintext to a terminal, or to a pipe or file only with --reveal (otherwise it exits E401 before decrypting), and --json carries the key names with every value shown as [REDACTED]; --reveal --json is E402. secrets rekey --remove <pubkey> re-encrypts everything without a departed team member's key.
nself config secrets resolve --project <directory> --for-attempt a1 --json project/FOO | <consumer> emits a cli.secret-resolve/v1 data document. In v1.4 use nself secrets resolve; both modes emit the canonical envelope. Stdout must be an anonymous or named pipe (FIFO). Terminals, regular files, sockets and /dev/null are E542 before decryption. There is no reveal option; stdin is never read.
| Reference | Encrypted file |
|---|---|
project/NAME |
<project>/.secrets/ci.age |
environment/<env>/NAME |
<project>/.secrets/ci-<env>.age |
deploy/<env>/NAME |
<project>/.secrets/<env>.age |
release/NAME |
<project>/.secrets/release.age |
team/NAME |
$HOME/.config/nself/secrets/team.age |
NAME matches ^[A-Z][A-Z0-9_]{0,127}$; environments match ^[a-z][a-z0-9-]{0,31}$ and cannot be ci, release, team or begin with ci-. Duplicate NAMEs, malformed refs and explicit --env are E540. Missing files or keys are E541; unreadable identities and failed decryption are E543. --json and a valid --for-attempt are required. Values retain input order, include source: age:<basename> and have expires_at: null.
Resolve and recipient commands refuse symlinked store directories and files with E543. Project stores require a real .secrets directory and regular encrypted files; team references require a real $HOME/.config/nself/secrets directory and regular team.age file.
Every resolver call records exactly one secret-resolve audit event with grammar-valid refs, a valid attempt ID, absolute project, user and outcome, including refusals. Invalid refs are represented by their count and SHA-256 prefixes; invalid attempt IDs are represented by a SHA-256 prefix. Values never enter the audit record; an audit failure prevents value delivery. Resolve is CLI-only and refused over MCP and HTTP.
nself config secrets recipients add --project <directory> --file ci <age-public-key> grants access to an existing store. remove --file ci <age-public-key> removes a recipient; list --file ci prints public recipients. --project defaults to the current directory, is made absolute, and must name an existing directory for every action. In v1.4 use nself secrets recipients. In v1.5 --json emits recipient envelopes.
Files are ci, ci-<env>, release or a deploy <env>, with the reserved environment rules above. Only the store owner, the first recorded recipient, may add or remove recipients (E544 otherwise). Removing the owner is E544; use secrets rekey for owner changes. Add and remove on release or deploy files also require --allow-release-class. Add never creates a missing store. Empty or malformed recipient metadata is E543, including on list. Duplicate additions leave ciphertext unchanged. Each change records one secret-recipients event with action, file, public recipient, project and user before re-encryption; a failed audit leaves ciphertext unchanged. A save failure after the audit is E543. The operator private identity is never copied or printed. Add, remove and list are CLI-only.
Removal does not revoke plaintext already read. Rotate secret values after removing a recipient. Any identity that can decrypt a file can re-encrypt it with age directly, so nodes must get read-only checkouts. The CLI owner guard prevents accidents; it is not a security boundary.
Run grants against an operator-trusted checkout. A writer can copy ciphertext from release.age to ci.age; granting that copy uses the lower class because the filename determines the class (D-0509). Symlink refusal does not prevent ciphertext copies.
Pass an absolute --project to resolve and recipient commands. Monorepo startup may change the working directory to backend/ before a relative path or the default project is resolved (D-0510).
# Bootstrap encryption for a new project member
nself secrets init
# Set a secret in the dev environment
nself secrets set STRIPE_SECRET_KEY sk_test_xxx
# Set a secret in production by prompt
nself secrets set --env prod STRIPE_SECRET_KEY
# Keep the value off the command line: with VALUE omitted (or "-"), the value is
# read from stdin. A terminal gets a no-echo prompt; a pipe is read up to 1 MiB
# and one trailing newline is trimmed
printf '%s' "$STRIPE_KEY_FROM_VAULT" | nself secrets set --env prod STRIPE_SECRET_KEY -
# Show all secret keys (values redacted)
nself secrets list --env prod
# Rotate a key with a 7-day dual-window
nself secrets rotate --env prod JWT_SIGNING_KEY --dual-window
# After verifying the new key works, retire the old one
nself secrets retire --env prod JWT_SIGNING_KEY
# Audit which secrets are overdue for rotation
nself secrets audit --env prod
# Check git-tracked files for plaintext leakage
nself secrets lint
# Remove a departed team member's pubkey and re-encrypt everything
nself secrets rekey --remove "age1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"- cmd-env, multi-environment management
- cmd-backup, encrypted backups
- cmd-license, license keys
- Commands, full command index
Getting Started
Commands
- Commands, Overview
- Lifecycle: cmd-init · cmd-build · cmd-start · cmd-stop · cmd-restart · cmd-dev
- Monitoring: cmd-status · cmd-logs · cmd-health · cmd-urls · cmd-doctor · cmd-monitor · cmd-alerts · cmd-sentry · cmd-watchdog
- Data: cmd-db · cmd-backup · cmd-dr · cmd-queue · cmd-webhooks
- Config: cmd-config · cmd-service · cmd-env · cmd-promote
- Networking: cmd-ssl · cmd-trust · cmd-dns-setup
- Security: cmd-access · cmd-security · cmd-secrets
- Tenancy: cmd-tenant · cmd-billing
- Plugins: cmd-plugin · cmd-license · cmd-dogfood (extracted, CLI-R11) · cmd-k8s (extracted, CLI-R11) · cmd-encryption (extracted, CLI-R11) · cmd-waf (extracted, CLI-R11) · cmd-federation (extracted, CLI-R11) · cmd-mail (extracted, CLI-R11) · cmd-dlq (extracted, CLI-R11)
- AI: cmd-ai · cmd-claw · cmd-model
- Templates: cmd-template
- Utilities: cmd-exec · cmd-clean · cmd-reset · cmd-update · cmd-upgrade · cmd-version · cmd-admin · cmd-migrate · cmd-migrate-firebase · cmd-migrate-supabase · cmd-completion
Features
- Features, Overview
- Feature-Auth
- Feature-Storage
- Feature-Search
- Feature-Functions
- Feature-Email
- Feature-Monitoring
- Feature-Plugins
- Feature-nClaw, AI Assistant
- Feature-nChat, Messaging
- Feature-nFamily, Family Social
- Feature-nCloud, Managed Hosting
- Feature-Memory-Rooms, Knowledge Organization
- Feature-Agent-Dashboard, Agent Metrics
- Feature-Image-Generation, AI Image Generation
Configuration
- Configuration, Overview
- Config-Env-Vars
- Config-Postgres
- Config-Hasura
- Config-Auth
- Config-Nginx
- Shared-Proxy
- Config-Optional-Services
- Config-Custom-Services
- Config-System
Plugins (87 + 10 monitoring)
- Plugin-Overview
- Plugin-Catalog
- Plugin-Install
- Plugin-Licensing
- Plugin-Architecture
- Plugin-Dev-Guide
- Plugin-Migrations-Contract
Free (25)
- plugin-backup
- plugin-content-acquisition
- plugin-content-progress
- plugin-cron
- plugin-donorbox
- plugin-feature-flags
- plugin-github
- plugin-github-runner
- plugin-invitations
- plugin-jobs
- plugin-link-preview
- plugin-mdns
- plugin-mlflow
- plugin-monitoring
- plugin-notifications
- plugin-notify
- plugin-paypal
- plugin-search
- plugin-shopify
- plugin-stripe
- plugin-subtitle-manager
- plugin-tokens
- plugin-torrent-manager
- plugin-vpn
- plugin-webhooks
Pro (62)
- plugin-access-controls
- plugin-activity-feed
- plugin-admin-api
- plugin-analytics
- plugin-auth
- plugin-bots
- plugin-browser
- plugin-calendar
- plugin-cdn
- plugin-chat
- plugin-claw
- plugin-claw-budget
- plugin-claw-news
- plugin-claw-web
- plugin-cloudflare
- plugin-cms
- plugin-compliance
- plugin-ddns
- plugin-devices
- plugin-documents
- plugin-entitlements
- plugin-file-processing
- plugin-game-metadata
- plugin-geocoding
- plugin-geolocation
- plugin-google
- plugin-home
- plugin-idme
- plugin-knowledge-base
- plugin-linkedin
- plugin-livekit
- plugin-media-processing
- plugin-meetings
- plugin-moderation
- plugin-mux
- plugin-object-storage
- plugin-observability
- plugin-photos
- plugin-podcast
- plugin-post
- plugin-realtime
- plugin-retro-gaming
- plugin-rom-discovery
- plugin-social
- plugin-sports
- plugin-support
- plugin-tmdb
- plugin-voice
- plugin-web3
- plugin-workflows
Planned (26)
plugin-auditplugin-blogplugin-checkoutplugin-commerceplugin-drmplugin-exportplugin-flowplugin-importplugin-ldapplugin-mailgunplugin-mediaplugin-oauth-providersplugin-pagesplugin-postmarkplugin-rate-limitplugin-reportsplugin-samlplugin-schedulerplugin-sendgridplugin-ssoplugin-subscriptionplugin-thumbplugin-transcoderplugin-twilioplugin-wafplugin-watermark
Guides
- Guide-Production-Deployment
- Guide-SSL-Setup
- Guide-Multi-Tenancy
- Guide-Security-Hardening
- Guide-Monitoring-Setup
- Guide-Backup-Restore
- Guide-Custom-Services
- Guide-Migration-from-v1
Architecture
- Architecture
- Architecture-Guardrails
- Service-Graph
- Compose-Generation
- Nginx-Generation
- Plugin-Architecture
Reference
Machine interface
-
JSON-Output,
--jsonenvelope -
Command-Registry,
nself help --json - Exit-Codes
- error-codes, Error Codes
-
Compat-V15,
NSELF_V15gate
Licensing
Security
Brand
Operations
- operations/release-cascade, Release Cascade
- operations/self-healing, Self-Healing Schema
- operations/redis-tuning, Redis Pool Tuning
- operations/meilisearch-warmup, MeiliSearch Warm-Up
- operations/jwt-rotation, JWT Key Rotation
- operations/windows-wsl2-setup, Windows / WSL2 Setup
- operations/gemini-oauth-reauth, Gemini OAuth Reauth
Contributing
Admin
- USER-ACTION-QUEUE, Pending Admin Actions
All commands (21)
- A: cmd-add · cmd-admin
- B: cmd-backup · cmd-build
- C: cmd-clean · cmd-config
- D: cmd-db · cmd-deploy · cmd-doctor
- E: cmd-exec
- I: cmd-init
- L: cmd-license · cmd-logs
- M: cmd-mcp
- R: cmd-remove · cmd-reset · cmd-restart
- S: cmd-start · cmd-status · cmd-stop
- U: cmd-update