Why Your Team Needs a Secret Policy (Not Just a Vault)
You walk into a team room and ask five developers where they keep database passwords. One points to a .env file in the project root. Another has a private note in their password manager. A third pasted an API token as a comment in the code, right above the function that uses it. The fourth developer swears they put it in the vault, but nobody else can find it. The fifth just shrugs.
This is not a security failure. It is a coordination failure. Every developer had a reason for their choice. The .env file was fast. The private note was convenient. The code comment was visible. The vault entry was technically correct but undocumented. The shrug was honest.
The problem is not that secrets exist. The problem is that there is no shared rule about how secrets are managed across the team and across environments. Without a policy, every developer optimizes for their own workflow, and the result is inconsistency. Inconsistency means you cannot guarantee that production secrets are handled the same way as development secrets. You cannot guarantee that a rotated secret reaches every environment. You cannot guarantee that an ex-team member no longer has access.
A secret policy is not a formal document that gets filed away after one read. It is a set of rules that gets translated into vault configuration and pipeline behavior. The goal is simple: no matter which environment you look at, secrets are accessed and managed the same way.
Who Can Access What
The first rule to establish is about access. Who can read a secret in development? Who can read a secret in production? These are not the same question.
In development, most team members need access to secrets so the application can run on their local machine. That is fine. The risk is low, and blocking access would slow everyone down. But in production, access must be restricted. Not every developer needs to know the production database password or the payment gateway API token. The principle here is least privilege: every person or system gets only the secrets required to do their job.
The way to enforce this is through vault policies. A policy defines which paths a user or system can read. For example, secret/development/* might be readable by all team members, while secret/production/* is readable only by the deployment pipeline and a few designated senior engineers. This is not a written rule that people are expected to follow manually. It is a configuration that the vault enforces. If a developer tries to read a production secret from their laptop, the vault refuses. The audit log records the attempt.
Keep Environments Separate
The second rule is about environment boundaries. Production secrets must never be used in development or staging. Development secrets must never leak into production.
This sounds obvious, but it happens more often than you think. A team is in a hurry. They need to test a feature that talks to an external service. Instead of creating a separate test credential, they copy the production token into staging. The test works. Nobody remembers to remove it. Later, a developer accidentally logs the staging environment variables, and the production token ends up in a log file that is visible to the whole team. Now production is exposed because of a staging shortcut.
The enforcement here is structural. Separate vault paths per environment. The development pipeline only has access to the development path. The staging pipeline only has access to the staging path. The production pipeline only has access to the production path. If a pipeline tries to read a secret from a different environment, the vault refuses and logs the attempt. This is not about trust. It is about making the wrong action impossible.
Rotation Must Be Automated
The third rule is about rotation. How often should secrets change? The answer depends on the environment.
Development secrets can rotate less frequently. If a development database password leaks, the blast radius is limited to the team. Rotating every three months is usually enough. Production secrets need more frequent rotation. Every month is a reasonable baseline. Every time a team member leaves, production secrets that they had access to should rotate immediately.
The key point is that rotation must be automated. Humans forget. Humans get busy. Humans cut corners when a deadline is near. The pipeline should handle rotation on a schedule. If a secret has not been rotated by the scheduled date, the pipeline should flag it or block deployments until the rotation happens. This is not about punishing the team. It is about removing the cognitive load of remembering to rotate.
Plan for Recovery
The fourth rule is about recovery. Secrets get lost. Vault paths get deleted by accident. Someone rotates a secret and forgets to update the downstream service. When this happens, the team needs a way to recover without changing application configuration.
Most vaults provide version history. A deleted secret can be restored to a previous version. But the policy needs to define who is authorized to perform recovery and how the process is logged. Recovery should not be a free action that anyone can take. It should require approval and leave an audit trail. Otherwise, recovery becomes a backdoor that bypasses all the other rules.
Make It Enforceable
All these rules are useless if they exist only as a document. A secret policy that lives in a wiki and is never translated into configuration is not a policy. It is a suggestion.
Three components make a secret policy real:
- Vault policies that enforce access rules per environment.
- Pipelines that are isolated per environment and cannot cross paths.
- Audit logs that are reviewed regularly, not just stored.
Without these three components, the policy is just words. With them, the policy becomes the default behavior of the system. Developers do not need to remember the rules. The system enforces them automatically.
Practical Checklist
If you are setting up a secret policy for your team, here is a short list to work through:
- Define which vault paths are readable by which roles per environment.
- Configure vault policies to enforce those rules, not just document them.
- Separate pipeline access so each environment can only reach its own secrets.
- Set rotation schedules per environment and automate them in the pipeline.
- Define who can recover deleted secrets and how the recovery is logged.
- Review audit logs at least once per month for unexpected access attempts.
The Takeaway
A secret vault is a tool. A secret policy is the rulebook that makes the tool useful. Without the policy, the vault is just another place where secrets are stored inconsistently. With the policy, the vault becomes a system that enforces how secrets are accessed, rotated, and recovered across every environment your team runs. Start with the rules, then configure the vault to enforce them. That is the difference between having a secret management tool and actually managing secrets.