What are secrets?
Secrets are sensitive values - API keys, database passwords, TLS certificates - that need to be encrypted at rest and tightly access-controlled.
In Nexus, secrets are:
- Encrypted with AES-256-GCM at rest
- Never returned in plaintext via the audit log
- Versioned - every write creates a new version; previous versions can be promoted
- Scoped to a service and an environment
- Only available to backend services (secret keys); frontend services (public keys) never receive secrets
Key names
Secret keys follow the pattern ^[a-zA-Z]([a-zA-Z0-9_.:-]*[a-zA-Z0-9])?$ - letters, digits, dots, underscores, hyphens, and colons.
Examples: stripe.secret_key, db:password, TLS_CERT
Secret types
Reading secrets
All backend SDKs provide a typed accessor. Calling GetSecret with a public key or on a frontend-kind service raises an error - secrets are never sent to frontend services.
GetSecret raises ErrPublicKeyRestricted (Go) / NexusPublicKeyError (Node) if called with a public key.
It raises ErrServiceKindMismatch / NexusServiceKindMismatchError on a kind=frontend service regardless of key type.
Using secrets in configs
Configs can reference secrets by key using the {{secret:KEY}} template syntax. The value is resolved server-side at sync time and delivered as the resolved string - the secret value is never stored in plaintext in the config.
Versioning
Every write to a secret creates a new version. You can:
- View version history in the console
- Promote an older version to become the current value
- See the diff between versions
Audit log
The following events are recorded for secrets: