API keys, database passwords, M-Pesa credentials and signing keys are the keys to your business. They leak more often than most teams realise: committed to Git, pasted in chat, printed in logs or left in old servers.
Where secrets leak
- Committed to code repositories, including in old commits.
- Shared in chat messages and emails.
- Printed in logs and error messages.
- Baked into Docker images.
- Stored in plain-text files on servers and laptops.
Better storage
| Option | Good for |
|---|
| Environment variables injected at runtime | Simple deployments |
| Cloud secrets managers | Cloud-hosted apps, rotation, audit logs |
| Vault-style tools | Multiple environments, dynamic secrets |
| Password managers | Human access to shared credentials |
Tired of risky deployments and surprise downtime?
We set up CI/CD, monitoring and infrastructure that lets your team ship calmly.
Practices
- Never commit secrets; add secret scanning to your repository and CI.
- Use different secrets for each environment.
- Grant each service only the secrets it needs.
- Rotate secrets regularly and immediately after staff changes or suspected leaks.
- Prefer short-lived credentials and roles over long-lived keys.
- Log access to secrets.
If a secret leaks
- Revoke or rotate it immediately; deleting the commit is not enough.
- Check logs for misuse.
- Find how it leaked and fix the process.
- Notify affected parties if data may have been accessed.
Key takeaways
- Secrets leak through code, chat, logs and images.
- Store them in a secrets manager or inject at runtime.
- Scan repositories automatically.
- Rotate immediately after any suspected leak.
Frequently asked questions
Is a .env file safe?
On a protected server, outside the repository and with tight permissions, it is acceptable for small setups.
How often should we rotate secrets?
Regularly, such as every 90 days, and always after staff changes or incidents.
Can you audit our secrets handling?
Yes. We scan repositories, review storage and set up rotation.
Tired of risky deployments and surprise downtime?
We set up CI/CD, monitoring and infrastructure that lets your team ship calmly.
Comments (0)
Sign in to comment.