You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(rees): scan added lines whose content starts with ++ across all diff parsers (#2531)
Every review-enrichment diff parser guarded file headers with an unanchored
`startsWith("+++")`. git renders an added line whose content is `++x` as
`+` + `++x` = `+++x` (and `++ x` as `+++ x`), so that line was mistaken for a
`+++ b/file` header and skipped. In secret-scan.ts a secret on such a line was
never scanned (scanSecrets calls scanPatch directly).
Fixes, by parser input shape:
- Hunk-structured parsers (secret-scan, secret-log, iac-misconfig, redos,
actions-pin, eol-check, duplication-scan, shared analysis-context) track hunk
state: headers only precede the first @@, and inside a hunk the first char is
the +/-/space op, so both `+++x` and `+++ x` are scanned.
- Parsers that also accept header-only/headerless fragments (history,
heavy-dependency) use a shared isDiffFileHeaderLine helper that matches only a
real header form (`+++ b/…`/`--- a/…`/`/dev/null`), so `+++ x` content is kept
while true headers are skipped — and headerless single-line diffs still work.
- Manifest/lockfile parsers (dependency-scan, lockfile-drift) keep an anchored
`+++ ` guard; their content never begins a line with `++`.
Adds regression tests: scanPatch finds a secret on both `++x`- and `++ x`-content
lines, collectAddedLines recovers the `++x` line, and isDiffFileHeaderLine has a
unit covering headers vs `++`/`--` content and headerless diffs.
No issue because issue creation is restricted on this repo; this consolidates a
duplicated diff-parsing guard, no schema or API change.
0 commit comments