Skip to content

fix: scan gitignored .env files (audit C1, critical) - #47

Merged
emmanuelgjr merged 1 commit into
mainfrom
fix/audit-discovery
Jul 18, 2026
Merged

fix: scan gitignored .env files (audit C1, critical)#47
emmanuelgjr merged 1 commit into
mainfrom
fix/audit-discovery

Conversation

@emmanuelgjr

Copy link
Copy Markdown
Contributor

Critical audit fix. Discovery honored .gitignore via git ls-files, so a normally-gitignored .env was never scanned — the flagship 'hardcoded key in .env' detection silently didn't run in real repos. The committed fixture .env (tracked) masked it.

Fix: credential files matching ALWAYS_SCAN_GLOBS (.env, *.env, .env.*, *.envrc) are now scanned even when gitignored. Verified: real-repo layout now catches the key (DSGAI02 FAIL); fixture scan unchanged (32, exact); regression test added.

Discovery used 'git ls-files --cached --others --exclude-standard', which drops
gitignored+untracked files. In a real repo .env is gitignored, so the flagship
value-bearing credential detection (hardcoded key in .env) silently never ran —
the report showed a clean bill over a live key. The committed fixture .env
(tracked) masked this in tests.

Fix: union git discovery with a targeted walk for ALWAYS_SCAN_GLOBS (.env, *.env,
.env.*, *.envrc) so credential files are scanned even when gitignored. Fixture
scan unchanged (32 findings, exact); added a regression test with a real-world
gitignored-.env repo layout (would have caught this).
@emmanuelgjr
emmanuelgjr merged commit f7002eb into main Jul 18, 2026
9 checks passed
@emmanuelgjr
emmanuelgjr deleted the fix/audit-discovery branch July 18, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant