fleetlint Policy for a fleet of repositories
v0.7
Getting started

repo/no-tracked-env

No .env files are tracked

Severityerror
Tiersall
Stacksany
Scoperoot
Kindexpr
Sourcelibrary v0.4.0
Selected byfleetlint-minimal@v0.4.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)/'))
false

Fix

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.

Sources


Generated by fleetlint docs from catalog v0.4.0.