Skip to content

feat(verify): real SBOM parsing + CVE/OSV checking, fail-closed (closes #15, #13) - #17

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/sbom-parse-and-cve-osv
Jun 9, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/sbom-parse-and-cve-osv

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #15 and #13. Fixes the CVE false-pass security hole.

The hole (from the vet survey)

vet verify --check-cves critical was a no-op: checkCVEs returned hardcoded-clean, the gate keyed on those always-false values, and QueryOSV (a real OSV query) was orphaned. An artifact with critical CVEs silently passed.

Fix

  • SBOM is checked for existence only, never parsed or validated #15 — SBOM parsing (internal/sbom/parse.go): parse syft's SPDX-JSON & CycloneDX-JSON into a package list, preferring PURL (encodes ecosystem) with name+version fallback. SBOMPresent now means a valid SBOM with ≥1 package, not a file exists. Distinct ErrNoSBOM / ErrEmptySBOM / parse errors.
  • vet verify --check-cves is a no-op: CVE gating silently passes vulnerable artifacts #13 — real CVE check: checkCVEs parses the SBOM and queries OSV /v1/query (severity inline) per package via the now-wired queryOSV; sets CVECritical/CVEHigh from real severities. A ran flag distinguishes checked-clean from couldn't-check.
  • Fail-closed (the security fix): when --check-cves is requested but cannot run (no SBOM / unparseable / OSV unreachable), Verify records a policy failure → PolicyMet=false. Never a silent pass.

Design

Pure stdlib — SBOM via encoding/json + minimal structs, OSV over the injected http.Client. No new required CLI tool; go.mod gains no heavy deps. /v1/query over /v1/querybatch because 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 OSV RoundTripper + 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 gate consumes the verification record verify writes, so it benefits automatically once vet verify has run.

Not in scope (separate issues)

#14 (SLSA-level heuristic), #16 (gh docs / silent-skip), OSV batch optimization.

#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.
@scttfrdmn
scttfrdmn merged commit 81c839c into main Jun 9, 2026
1 check passed
@scttfrdmn
scttfrdmn deleted the feat/sbom-parse-and-cve-osv branch June 9, 2026 21:58
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.

SBOM is checked for existence only, never parsed or validated

1 participant