Skip to content

fix(scan): surface unparseable scanner output as error, not "ran clean" - #74

Merged
sandstream merged 1 commit into
mainfrom
fix/scan-surface-parse-errors
Jun 24, 2026
Merged

sandstream merged 1 commit into
mainfrom
fix/scan-surface-parse-errors

Conversation

@sandstream

@sandstream sandstream commented Jun 23, 2026 •

Copy link
Copy Markdown
Owner

runScanners piped scanner stdout through the lenient ingest(), which returns [] on any malformed input — so a scanner that printed a stack trace or the wrong format was recorded as ran with 0 findings, hiding behind a green consolidated verdict (classic fail-open).

Fix: new ingestStrict() distinguishes a valid-but-empty report from malformed/wrong-shape output (discriminated { ok }). runScanners marks unparseable output (and empty output from a failed process) as error; a valid empty SARIF/OSV stays ran/0. Lenient ingest() unchanged for kit ingest. Tests added. (Security review finding.)

`runScanners` piped every scanner's stdout through the lenient `ingest()`,
which returns `[]` on any malformed input. So a scanner that printed a stack
trace, an error blob, or the wrong format was recorded as `ran` with 0
findings — a broken scanner hid behind a green consolidated verdict, the
classic fail-open that a security gate must not have. (Internally inconsistent
too: `osvSeverity` already defaults unknown labels to `high`, i.e. cautious,
while parse failure was silently empty, i.e. uncautious.)

Add `ingestStrict()` to the ingest adapter: it distinguishes a *valid but
empty* report (scanner ran, found nothing) from *malformed / wrong-shape*
output, returning a discriminated `{ ok }` outcome. `runScanners` now marks an
unparseable non-empty output — and an empty output from a failed process — as
`error`, while a valid empty SARIF/OSV stays `ran/0`. The lenient `ingest()`
is unchanged for the `kit ingest` command and existing callers.

Follow-up (noted, not in scope): the `kit scan` command layer should let an
`error` scanner run downgrade the overall verdict rather than report all-clear.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 8ade269 into main Jun 24, 2026
15 checks passed
@sandstream
sandstream deleted the fix/scan-surface-parse-errors branch June 24, 2026 04:15
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.

2 participants