The problem: a secret in a file next to the application
An environment file looks harmless, yet in practice it collects the database password, the application key and access to the file store. Every copy of the folder copies it, and when the server changes someone passes it along by e-mail or a messenger. One mistake is enough and the password stays in the repository forever, because git history remembers everything.
That is why our practice assumes that even the example file contains only variable names, with no values at all, and that a blocking check in the pipeline enforces this automatically. The example file serves as a template, so it must be as safe as the rest of the repository.
The rule: a repository without variable files
The policy is simple: the code repository does not contain environment files. The values are kept in CI/CD, in the container environment on the servers and in the default values of the developer's local stack. As a result, the plant server has no file that someone could accidentally copy or quote in a support ticket.
For the administrator this means one thing: configuration is set where the container starts, not in the folder with the code.
A names contract instead of a file with values
The list of required environment variables is kept in the repository as a contract that contains names only, without values. An automated test in every pipeline checks that no required name is missing and that the file contains no equals sign. It is a simple mechanism: whoever adds a new variable must add its name to the contract, and whoever tries to write a value stops the pipeline.
Thanks to this, the plant administrator gets a complete list of what to set and can compare it with what actually runs in the environment.
Operating mode always explicit
On the servers the container environment supplies the whole configuration. The variable that sets the operating mode of the application is always set, and a missing variable stops the start instead of silently switching on development mode with a debugger. This guards against a classic mistake: production running in development mode, with error messages visible to everyone.
Record in the installation description which variables set the mode and who changes them.
A clear message about a missing variable
A missing configuration variable ends with a message that names the missing setting, not with a message about a missing file. This matters for diagnostics: when the message names the missing setting, the administrator does not lose time searching for the cause in the network or in other components.
Secret scanning in the pipeline
Secret scanning in the pipeline blocks a password or key from entering the repository. It is the second safeguard after the no-files rule: even if someone writes a password into the code or the documentation, the pipeline stops it. For the plant the benefit is twofold: a lower risk of a leak, and evidence for supplier audits that the manufacturer applies such a mechanism.
If you want to check your own integration repository, read the guide on secret scanning at the software supplier.
Checklist
Video
Frequently asked questions
So where do the passwords live?
In CI/CD, in the container environment on the servers and in the default values of the developer's local stack. The repository does not contain them.
What happens when a variable is missing?
The application stops its start and names the missing setting, instead of starting in development mode.
Is a file with variable names a leak?
No. The contract contains names only, with no values, and a test makes sure no equals sign appears in it.
Does secret scanning replace a code review?
No, but it blocks one class of errors automatically, before a secret reaches the repository.
Sources
Ask us about our configuration contract
We will show the plant administrator what the variable contract looks like and the test that makes sure it is complete.
Let's talk