Skip to content

fix(audit): honor Git ignore rules when scanning personal paths - #1250

Merged
debugmcpdev merged 2 commits into
mainfrom
fix/audit-git-candidates
Nov 24, 2026
Merged

debugmcpdev merged 2 commits into
mainfrom
fix/audit-git-candidates

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Closes #1245.

The full personal-path audit used its own directory walker and visited ignored files in the installed Windows CodeLLDB payload. Two URLs in Python's standard library were enough to fail the check.

Ask Git for tracked files plus untracked, nonignored candidates, using NUL-delimited paths. Both full and staged audits now use the same file scanner. A tracked file stays in scope even when it matches an ignore rule.

Verified that the old audit reported both false positives with the payload installed and the new audit passed on that checkout. A CLI regression test checks an ignored payload, a force-tracked file inside that payload, and an untracked source file with a space in its name. All nine focused tests passed.

@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@debugmcpdev debugmcpdev left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against #1245 and audited both scripts/check-all-personal-paths.cjs and its shared scanner in scripts/check-personal-paths.cjs. Switching the full audit to git ls-files -z --cached --others --exclude-standard cleanly honors nested .gitignore rules (including installed CodeLLDB payloads) while keeping force-tracked files in scope.

During review, I found and fixed 5 additional edge cases across both scripts (pushing onto this branch rebased onto main next):

  1. Staged scanner -z paths: getStagedFiles() previously called git diff --cached --name-only without -z, allowing C-quoted non-ASCII/special paths to be silently skipped by s.existsSync.
  2. Windows excludeDirs separator mismatch: getStagedFiles() split Git's / output on path.sep (\ on Windows), making excludeDirs inert on Windows.
  3. Subdirectory cwd resolution: Both scripts now resolve --show-toplevel and read files relative to the worktree root so running either check from a nested package directory still audits the full worktree / staged set.
  4. .env / .env. and uppercase extensions*: path.extname('.env') is '' and path.extname('.env.local') is '.local'; centralized isAuditablePath now covers .env, .env.*, and case-insensitive extensions.
  5. execFileSync maxBuffer & deduplication: Raised maxBuffer to 16 MiB and deduplicated NUL-delimited path sets.

debugmcpdev and others added 2 commits November 24, 2026 01:10
Use NUL-delimited Git paths rooted at --show-toplevel in both scripts, normalize Windows slash separators in staged excludeDirs filtering, match .env/.env.* and uppercase extensions, and raise execFileSync maxBuffer.
@debugmcpdev
debugmcpdev force-pushed the fix/audit-git-candidates branch from ec74b05 to cc897d5 Compare November 24, 2026 06:33
@debugmcpdev
debugmcpdev merged commit beeb229 into main Nov 24, 2026
16 checks passed
@debugmcpdev
debugmcpdev deleted the fix/audit-git-candidates branch November 24, 2026 06: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.

Full personal-path audit flags two documentation URLs in the installed Windows CodeLLDB payload

2 participants