Skip to content

feat: pluggable CVE-scanning seam (internal/cve) — vet#32 slice 1 - #33

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/cve-source-seam
Jun 25, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/cve-source-seam

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

First slice of vet#32 (AMI deep-content scanning). Pure refactor + foundation — no behaviour change, no AWS.

Why

A live both-source test (vet#32 comment) on a real AL2023 instance showed the two viable AMI CVE sources have different sharp edges:

  • Amazon Inspector — managed, ALAS-native, but billable and gated on the instance being Inspector-managed (or agentless EBS-snapshot scanning).
  • EBS snapshot → syft → matcher — self-contained, on-demand, but a naive OSV Linux query returns false-clean for Amazon Linux packages (OSV's Linux ecosystem is upstream-kernel-scoped, not ALAS-aware).

So CVE scanning should be a strategy, not a hardcoded OSV call. This slice introduces the seam they plug into.

What

  • New internal/cve: a Source interface — Scan(ctx, []sbom.Package) (Verdict, error) — and the existing per-package OSV query moved verbatim into the default OSVSource.
  • verify.Verifier gains a cveSource field (defaults to OSV) and WithCVESource(...). checkCVEs now loads the SBOM and delegates to the source.
  • No behaviour change for container/binary SBOMs: the existing verify CVE tests pass through the seam unchanged.
  • The OSV source reports unresolvable bare-name packages as Scanned: 0 (not a false pass) — the honest version of the OSV-Linux≠ALAS gap. Fail-closed preserved: a source that can't evaluate returns an error and the gate denies.

Tests

  • New internal/cve/osv_test.go: critical / high / clean / transport-fail-closed / unresolvable-bare-name / by-ecosystem / multi-package aggregation.
  • Existing internal/verify CVE tests unchanged and green.

Next slices

inspector source (agentless EBS scan, ALAS-native) and snapshot+grype source (distro-aware matcher), each behind this interface; both need live AWS so they'll follow the suite pattern (injectable interfaces + fakes in CI, live wiring manual).

Note: gofmt flags internal/sign/sign.go on the current toolchain — pre-existing drift, not touched by this PR.

Foundation for AMI deep-content scanning. A live both-source test (vet#32)
showed the two viable AMI CVE sources have different sharp edges, so CVE
scanning should be a strategy, not a hardcoded OSV call.

- New internal/cve: a `Source` interface (Scan([]sbom.Package) -> Verdict) +
  the existing per-package OSV query moved verbatim into the default `OSVSource`.
- verify.Verifier gains a `cveSource` field (default OSV) and `WithCVESource`;
  checkCVEs now loads the SBOM and delegates to the source. No behaviour change
  for container/binary SBOMs — the existing CVE tests pass through the seam.
- The OSV source reports unresolvable bare-name packages as scanned:0 (not a
  false pass) — the honest version of the "OSV Linux != ALAS" gap the live test
  found. Fail-closed preserved: a source that can't evaluate returns an error
  and the gate denies.

The inspector and snapshot+grype AMI sources land in follow-up slices.

Tests: new internal/cve/osv_test.go (critical/high/clean/fail-closed/
unresolvable/ecosystem/aggregate); existing verify CVE tests unchanged + green.
@scttfrdmn
scttfrdmn merged commit 085e9b4 into main Jun 25, 2026
2 checks passed
@scttfrdmn
scttfrdmn deleted the feat/cve-source-seam branch June 25, 2026 20:43
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