Repository navigation
feat(verify): real SBOM parsing + CVE/OSV checking, fail-closed (closes #15, #13) - #17
Merged
Merged
Conversation
#15, #13) Fixes the security false-pass found in the vet survey: vet verify --check-cves was a no-op (checkCVEs hardcoded clean, QueryOSV orphaned), so --check-cves critical silently passed artifacts with critical CVEs. #15 — internal/sbom/parse.go: parse syft's SPDX-JSON and CycloneDX-JSON into a package list (sbom.Load/Parse), preferring PURL (encodes ecosystem) with name+version fallback. SBOMPresent now means 'a valid SBOM with >=1 package', not merely a file on disk. Distinct ErrNoSBOM / ErrEmptySBOM / parse errors. #13 — verify.checkCVEs now parses the SBOM and queries OSV (/v1/query, which returns severity inline) per package via the wired-in queryOSV; sets CVECritical/CVEHigh from real severities. Returns a 'ran' flag distinguishing 'checked, clean' from 'could not check'. Fail-closed (the security fix): when --check-cves is requested but the check cannot run (no SBOM / unparseable / OSV unreachable), Verify appends a policy failure so PolicyMet=false — never a silent pass. Previously the caller swallowed the error. Pure stdlib: SBOM parsed with encoding/json against minimal structs; OSV over the injected http.Client. No new required CLI tool; go.mod gains no heavy deps. Tests: sbom parser (SPDX/CycloneDX/absent/malformed/empty); verify CVE path via a stub OSV RoundTripper + seeded fixture SBOM — critical→deny, clean→pass, no-SBOM→fail-closed, OSV-error→fail-closed, incl. the end-to-end security regression test (--check-cves + no SBOM must DENY). Out of scope (separate issues): #14 SLSA-level heuristic; #16 gh docs/silent-skip; OSV /v1/querybatch optimization for very large SBOMs.
This was referenced Jun 9, 2026
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.
Closes #15 and #13. Fixes the CVE false-pass security hole.
The hole (from the vet survey)
vet verify --check-cves criticalwas a no-op:checkCVEsreturned hardcoded-clean, the gate keyed on those always-false values, andQueryOSV(a real OSV query) was orphaned. An artifact with critical CVEs silently passed.Fix
internal/sbom/parse.go): parse syft's SPDX-JSON & CycloneDX-JSON into a package list, preferring PURL (encodes ecosystem) with name+version fallback.SBOMPresentnow means a valid SBOM with ≥1 package, not a file exists. DistinctErrNoSBOM/ErrEmptySBOM/ parse errors.checkCVEsparses the SBOM and queries OSV/v1/query(severity inline) per package via the now-wiredqueryOSV; setsCVECritical/CVEHighfrom real severities. Aranflag distinguishes checked-clean from couldn't-check.--check-cvesis requested but cannot run (no SBOM / unparseable / OSV unreachable),Verifyrecords a policy failure →PolicyMet=false. Never a silent pass.Design
Pure stdlib — SBOM via
encoding/json+ minimal structs, OSV over the injectedhttp.Client. No new required CLI tool; go.mod gains no heavy deps./v1/queryover/v1/querybatchbecause batch returns only IDs (severity needs an N+1 fetch); noted as a future optimization for very large SBOMs.Tests
internal/sbom: SPDX / CycloneDX / absent (ErrNoSBOM) / malformed / empty (ErrEmptySBOM).internal/verify(stub OSVRoundTripper+ seeded fixture SBOM): critical→deny, clean→pass, no-SBOM→fail-closed, OSV-error→fail-closed, plus the end-to-end security regression (--check-cves+ no SBOM must DENY).go build/vet/test ./...green. Note:vet gateconsumes the verification record verify writes, so it benefits automatically oncevet verifyhas run.Not in scope (separate issues)
#14 (SLSA-level heuristic), #16 (
ghdocs / silent-skip), OSV batch optimization.