Skip to content

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

Open
pixincreate wants to merge 1 commit into
masterfrom
fix/scan-mode-consistency
Open

fix(scan): make git-history and staged modes behave like the others#88
pixincreate wants to merge 1 commit into
masterfrom
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.

@pixincreate
pixincreate force-pushed the fix/scan-mode-consistency branch from 2eccaf5 to 9798514 Compare August 26, 2026 17:32
@pixincreate
pixincreate marked this pull request as ready for review September 1, 2026 17:57
Base automatically changed from fix/report-hygiene to master September 1, 2026 18:15
@pixincreate
pixincreate force-pushed the fix/scan-mode-consistency branch from 9798514 to a0a09fd Compare September 1, 2026 18:15
@pixincreate pixincreate closed this Sep 1, 2026
@pixincreate
pixincreate force-pushed the fix/scan-mode-consistency branch from a0a09fd to 36ecd37 Compare September 1, 2026 18:28
@pixincreate pixincreate reopened this Sep 1, 2026
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 ef414e4 to c0cfe7b Compare September 1, 2026 18:38
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