Security and auth / Intermediate / 5 min / Updated
Secrets rotation: changing passwords without downtime
Rotate a database password used by four apps. Naive changes break them, overlapping passwords do not, and a vault makes leaked credentials expire.
Start the simulation → Change the load, break a part, watch what happens. Free, no sign-up.
In short
What is secrets rotation?
Secrets rotation replaces passwords and keys regularly so a leaked one stops working, without breaking the services using it.
Why does it matter?
Credentials leak through logs, laptops and repos. Rotation limits how long a leak is useful, and automation removes human error.
What is the trade-off?
Overlapping credentials or a vault add moving parts; manual one-step rotation is simple but causes outages and is done too rarely.
How do you explain it in an interview?
"Secrets in a vault, never in git; dynamic short-lived DB credentials per service; dual-credential rotation for third-party keys; alert on leaks."
Check yourself
You change the database password, then restart apps one by one. What goes wrong?
Answer: Apps not yet restarted use the old password and fail. Add the new credential first, roll the apps, then remove the old one: two valid credentials overlap during the change.
A short-lived credential from a vault leaks and nobody notices. What limits the damage?
Answer: It expires on its own when the lease ends. Dynamic secrets have a TTL; apps renew theirs, a stolen copy simply stops working.
Where should application secrets never be stored?
Answer: In the git repository, even a private one. Git keeps history forever and is copied to many laptops and CI runners; one leak exposes every old secret.