Cloud security Cloud secrets management 3 min read
Where should cloud application secrets live?
A database password is needed by one production service. Should it be copied into the repository, container image, and deployment file?
-
Store the secret outside the code
A managed secret store keeps the database credential out of source control and container images. The application asks for the secret at runtime through an authenticated cloud API.
In short Keep the credential out of artifacts that may be copied widely.
-
Use workload identity to retrieve it
Give the production service role permission to read the one secret it needs. A developer tool, unrelated service, or test environment should not inherit that permission by default.
In short Restrict retrieval to the right identity and secret.
-
Rotation must update both ends
Rotation changes the credential at the database and updates the stored secret. Applications need a safe way to pick up the new value, and monitoring should reveal repeated failed connections or unexpected reads.
In short A rotated value is useful only when dependent services adopt it.
What a secret manager doesn’t prevent
A compromised process with permission to retrieve a secret can read it. Avoid logging secret values, keep runtime permissions narrow, and rotate credentials after suspected exposure.
Secret stores differ in versioning, caching, and rotation behavior; account for those details in the application.
Keep this
Store secrets in a managed secret store and grant retrieval only to the workload that needs them.
A secret manager reduces accidental exposure; an overprivileged workload can still read and leak every secret it is allowed to retrieve.- Store
- Keep passwords and tokens out of repositories and images.
- Retrieve
- Use workload identity and narrow secret-level permissions.
- Rotate
- Replace credentials safely and update dependent services.