repo/no-tracked-env
No .env files are tracked
| Severity | error |
| Tiers | all |
| Stacks | any |
| Scope | root |
| Kind | expr |
| Source | library v0.1.0 |
| Selected by | fleetlint-minimal@v0.1.0 |
Requirement
Environment files that may hold credentials are never committed; templates with placeholder values (.env.example, .sample, .template, .dist), encrypted files (.sops, .enc, .age, .gpg, .asc) and test inputs under testdata/, fixtures/, __tests__/ and test directories are fine.
Why
A tracked .env is the most common way credentials leak into history.
Check
For each item in:
tracked().filter(f, f.matches('(^|/)\\.env(\\.[^/]*)?$')
&& !f.matches('\\.(example|sample|template|dist|sops|enc|age|gpg|asc)$')
&& !f.matches('(^|/)(testdata|fixtures?|__fixtures__|__tests__|tests?|spec)/'))falseFix
git rm –cached the .env file, add .env* to .gitignore, rotate any secret it contained. Frameworks such as Vite and Create React App commit .env and .env.development with non-secret defaults by design; keep those only without secrets and record each one as an exception with the reason in .fleetlint.yaml (exceptions: [{rule: repo/no-tracked-env, match: "web/.env.development", reason: "..."}]).
Agent instruction: Untrack the .env file, add .env and .env.* (but not .env.example) to .gitignore, and tell the user which secrets must be rotated. If it is a framework’s committed defaults file (Vite, Create React App) without secrets, ask whether to add a .fleetlint.yaml exception with the reason instead.
See: https://fleetlint.org/baseline/#security
Generated by fleetlint docs from catalog v0.1.0.