Skip to content

Contract test: exploitability survives scan -> gate #1464

Closed

Description

@lex00

Source of truth: epic #1461. On main under packages/core/src/components/verbs/. Cold-handoff; the pre-existing local vitest failures are green in CI — ignore that baseline, add no NEW failures. tsc/eslint clean. Branch, commit Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>, PR to main, end body with the Claude Code line.

Phase 1 of 4. Depends on #1462 and #1463.

Problem

There are two paths a finding can take to the gate, and the exploitability fields must survive both:

  1. scan-vulnerabilities step → ScanVulnerabilitiesOutput.findings → vuln-gate step's findings input
  2. vuln-gate with no findings → gate scans the SBOM itself via the injected VulnScanner (createVulnGateCapability, verbs/vuln-gate.ts)

Path 1 crosses a capability boundary and a phase-output wiring ("@Sbom.sbom"-style). It is exactly the kind of seam where a field gets dropped by an intermediate mapping and nobody notices until a KEV finding silently fails to block.

Scope

A test file (extend vuln-gate.test.ts, or add exploitability-roundtrip.test.ts beside it) proving a finding carrying inKev, epss, epssPercentile and the KEV date fields arrives at the gate intact via both paths.

⚠️ MockVulnScanner does not exist

verbs/vuln-scan.ts:13 and :75 both point at ./__tests__/mock-vuln-scanner.ts. That file is not in the repo. verbs/__tests__/ contains only mock-cloud-executor.ts, mock-process-runner.ts, mock-sbom-generator.ts. Do not waste time looking for it.

The real pattern, from vuln-gate.test.ts:142, is an inline object literal:

const fake: VulnScanner = { async scan() { return [CRIT_FIXABLE]; } };
await createVulnGateCapability(fake).run(ctx, { sbom: SBOM_SPDX });

Use that. Also fix the two stale doc comments in verbs/vuln-scan.ts to describe the inline-fake pattern instead of naming a file that isn't there — it is two lines and it is the reason this issue needed a warning box.

(If you would rather add the missing MockVulnScanner than fix the comments, that is acceptable too, but pick one and leave the tree consistent. A comment pointing at a nonexistent file is the thing being fixed either way.)

Acceptance criteria

  • A finding with inKev: true, epss: 0.42, epssPercentile: 0.97 and KEV dates reaches vuln-gate with every field intact via the pre-scanned-findings path.
  • Same via the gate-scans-for-you path with an inline fake VulnScanner.
  • A finding with none of those fields reaches the gate with all six undefined — not false, not 0.
  • VEX suppression (applyVex) preserves the exploitability fields on findings it does not suppress. applyVex partitions into gating/suppressed; confirm it does not rebuild finding objects and drop unknown keys.
  • No live scanner, network, or vuln DB touched by any test added here.
  • tsc and eslint clean.

Out of scope

Gate behavior — after this merges, a KEV finding still changes no outcome. #1465 does that. This issue only proves the data gets there.

Activity

  1. added
    enhancement
    on Aug 3, 2026
  2. changed the title [-]Contract test: exploitability survives scan → gate[/-] [+]Contract test: exploitability survives scan -> gate[/+] on Aug 3, 2026
  3. added a commit that references this issue on Sep 4, 2026
    ee41944
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions