ZTGIT

Secrets management: stop putting passwords in files

ZTGIT team

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:

  1. 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.
  2. 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.
  3. 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:

  1. 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.
  2. Stand up a vault and put the most sensitive secrets in it — production, payments.
  3. Read from the vault at runtime, service by service, instead of reading from the file. Start with new deploys.
  4. 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.

From the blog