Repository navigation
feat: pluggable CVE-scanning seam (internal/cve) — vet#32 slice 1 - #33
Merged
Merged
Conversation
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.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Linuxquery returns false-clean for Amazon Linux packages (OSV'sLinuxecosystem 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
internal/cve: aSourceinterface —Scan(ctx, []sbom.Package) (Verdict, error)— and the existing per-package OSV query moved verbatim into the defaultOSVSource.verify.Verifiergains acveSourcefield (defaults to OSV) andWithCVESource(...).checkCVEsnow loads the SBOM and delegates to the source.verifyCVE tests pass through the seam unchanged.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
internal/cve/osv_test.go: critical / high / clean / transport-fail-closed / unresolvable-bare-name / by-ecosystem / multi-package aggregation.internal/verifyCVE tests unchanged and green.Next slices
inspectorsource (agentless EBS scan, ALAS-native) andsnapshot+grypesource (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).