Skip to content

fix(scan): make git-history and staged modes behave like the others - #88

Draft
pixincreate wants to merge 1 commit into
fix/report-hygienefrom
fix/scan-mode-consistency
Draft

fix(scan): make git-history and staged modes behave like the others#88
pixincreate wants to merge 1 commit into
fix/report-hygienefrom
fix/scan-mode-consistency

Conversation

@pixincreate

Copy link
Copy Markdown
Owner

Stacked on #87.

Summary

Two scan modes behaved differently from the rest in ways that lost findings.

Changes

  • --git-history ignored --exclude and the baseline-file exclusion, so it scanned every historical revision of a committed baseline, and it keyed all findings under a synthetic <git-history> path that no baseline entry could ever match. Since git log -p emits the same diff framing as git diff --cached, history now reuses the staged parser — real file paths, real line numbers, exclusions applied. git log also gets the config hardening git diff already had.
  • diff.relative silently under-scanned. With diff.relative = true in a user's git config, running scan --staged from a subdirectory reported clean while a staged AWS key sat one level up (reproduced). Now pinned off with the other diff settings.

Tests

186 pass. New: history findings carry real paths and respect --exclude; a staged scan under diff.relative=true from a subdirectory still fails.

git-history ignored --exclude and the baseline-file exclusion, so it
scanned every historical revision of a committed baseline, and it keyed
every finding under a synthetic <git-history> path that no baseline
entry could ever match. Because git log -p emits the same diff framing
as git diff --cached, history now reuses the staged parser: real file
paths, real line numbers, exclusions applied. git log gets the same
config hardening as git diff.

diff.relative made git emit cwd-relative paths and drop changes outside
the current directory, so running the staged scan from a subdirectory
silently reported clean while a staged secret sat one level up. It is
now pinned off alongside the other diff settings.
@pixincreate
pixincreate force-pushed the fix/scan-mode-consistency branch from 2eccaf5 to 9798514 Compare August 26, 2026 17:32
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