Secrets management: stop putting passwords in files
The file problem
Almost every system starts with a .env or a config block holding the database password, the payment API key, the email service token. It works — and that is exactly why the problem grows unnoticed. Three weaknesses come with it:
- It leaks. The file gets into git “just this once,” is copied into a backup, shows up in an error log, is shared in a chat. A secret in plain text does not stay where you left it.
- It does not rotate. When a key must be changed — because someone left, or because it leaked — you have to hunt down every copy of it in every file on every machine. In practice it is not changed, and the old key lives forever.
- It is not audited. You do not know who read that file, or when. After an incident, there is no way to tell whether the secret was accessed.
What a vault solves
A secrets vault flips the logic: the secret no longer lives in the application’s file, it lives in the vault. The application requests it at runtime, proving its identity. With that you get:
- Access by identity: each service and each person gets only the secrets they need, under least privilege.
- Auditing: the vault records who read what and when.
- Rotation: changing a key is an operation in the vault, not a hunt across fifty files.
- Short-lived secrets: the vault can issue credentials that expire in minutes, so a leak has a short shelf life.
- PKI and on-demand issuance: many vaults issue certificates (PKI) and keys at the moment of use.
How to adopt without rewriting everything
Nobody rotates every secret in one weekend. The order that works:
- Take secrets out of git. First step, always: remove keys and passwords from code and history. If they were already committed, treat them as leaked and rotate them.
- Stand up a vault and put the most sensitive secrets in it — production, payments.
- Read from the vault at runtime, service by service, instead of reading from the file. Start with new deploys.
- Turn on rotation where the vault supports dynamic generation.
Each step reduces risk on its own; you do not need to reach the end to benefit.
In ZTGIT
ZTGIT-Vault is based on OpenBao (the open fork of Vault) and is the central vault: it stores secrets, controls access by identity — tied to SSO — and records every read. For people, ZTGIT-PersonalVault (based on Vaultwarden) handles individual passwords.
Consistent with the rest of the project: the rule “no secret in plain text” applies to ZTGIT itself — keys live in the vault, never in the repository or in notes.