Secrets live in a secret store

Credentials and keys are read from a secret manager at run time, never from the repository or plain configuration.

CriticalChecked automatically

Applies to:
Services that use secrets
Rule id:
security.secrets-in-store

Why it matters

A secret in a repository is in every clone, every fork and every backup of it, permanently. A secret in a plain environment variable shows up in deploy logs, crash dumps and the screen of anyone who can describe the deployment. Either way you can't say who has seen it, and you can't rotate it without a release.

How to apply it

  • Keep every credential, key and token in a secret manager, and name which one in the design.
  • The service reads secrets at start-up or on demand, using its own identity, not a shared master credential.
  • Rotate on a schedule and after anyone with access leaves. Rotation that needs a deploy will not happen.
  • Scan the repository for committed secrets in CI.

Example

security.secrets: [DB_PASSWORD, STRIPE_API_KEY] with security.secretStore: aws-secrets-manager, read through the service's own role.

References

Checklists with this rule

Related agent skill: microservice-security