ShtukbaseStandard
SCR-R03/norms/rules/std-owasp-secrets/SCR-R03.md

.env is ignored by git; no environment or key files in the repository

MUSTblockscheckflooractive
.env is ignored by git; no environment or key files in the repository
Why: A .env file is where secrets lie in plain text; one git add -A command sends them to history.
Page fields (15)
ruleIdSCR-R03
requirement.env is ignored by git; no environment or key files in the repository
levelMUST
floortrue
statusactive
spheresecurity
appliesTo.gitignore, .env
enforcers.shtukbase/packages/std-owasp-secrets/checks/scr03_env.ts
enforcerKindgate
modeenforce
becauseA .env file is where secrets lie in plain text; one git add -A command sends them to history.
baseline0
reviewBy2027-05-28
packstd-owasp-secrets
sourcesOWASP Secrets Management Cheat Sheet, https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html, OWASP ASVS 4.0.3 V2.10.4, https://github.com/OWASP/ASVS/tree/v4.0.3

.env is ignored by git. The repository (and the new files that git will add) has no environment files .env, .env.local, .env.production and similar, except the templates .env.example, .env.sample, .env.template without values; and no private key files id_rsa, id_ed25519, .p12, .pfx, .jks, .keystore.

Why. A .env file is where secrets lie in plain text; one git add -A command sends them to history.

How to fix. Add the lines .env, .env.* and !.env.example to .gitignore. Remove a file that got into git from the index and revoke its secrets.

Run. From the project root: shtuk run std-owasp-secrets env. A finding is a file, a line and the kind of secret; the value is not printed. In enforce mode the exit code is 1, in observe and warn it is 0. Settings: /norms/standards/owasp-secrets.md.

The enforcer is the env check of the std-owasp-secrets package.

The package Standard: secrets hygiene (OWASP) puts this page at /norms/rules/std-owasp-secrets/SCR-R03.md.Source text