Skip to content

fix(verify): structural SLSA level + honest missing-tool handling (closes #14, #16) - #18

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/slsa-structural-and-gh-ergonomics
Jun 9, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/slsa-structural-and-gh-ergonomics

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #14 and #16 — the two deferred verify follow-ups.

#14 — SLSA level was a hardcoded heuristic

The old extractSLSALevel regex matched a slsa level field that does not exist in gh attestation verify --format json, so it always fell through to return 2 on any output containing "verified". Replaced with structural parsing: gh returns an array of verified attestations carrying a statement.predicateType + provenance predicate. The level is derived honestly:

  • a verified slsa.dev/provenance/v1 attestation → L2;
  • a builder.id from slsa-framework/slsa-github-generator (the isolated reusable-workflow builder) → L3;
  • non-provenance predicate / garbage / prose → 0 (no false L2).

#16 — silent failures + undocumented deps

  • verifySLSA now returns a sentinel errGHMissing when gh is absent (distinct from gh-ran-and-found-nothing). Verify sets SLSAToolMissing and, under --min-slsa-level, fails closed with a clear reason instead of silently reporting level 0. CLI prints "gh CLI not installed" distinctly.
  • Documented the required tools (cosign / gh / syft) + fail-closed behavior in the vet verify help and a new README Required external tools table.
  • internal/sbom test coverage (was zero): syft invocation, --attest→cosign (image-only, skipped for local files), missing-syft error, CycloneDX format.
  • Fixed the README copyright prose (Scott Friedman → Playground Logic LLC) the earlier sweep missed.

Tests

slsaLevelFromGH (L2 hosted / L3 generator / wrong-predicate / garbage-no-false-L2), toolAvailable missing-tool, and the sbom generator suite. go build/vet/test ./... green; no new deps.

Completes the verify-hardening arc (after #17 closed #13/#15).

…oses #14, #16)

#14 — replace the SLSA-level regex (which matched a non-existent 'slsa level'
field and always fell back to a hardcoded L2 on any 'verified' text) with
structural parsing of 'gh attestation verify --format json'. gh has no explicit
level field, so the level is derived honestly: a verified slsa.dev/provenance/v1
attestation is L2; a builder id from slsa-framework/slsa-github-generator (the
isolated reusable-workflow builder) is L3. Garbage/prose no longer yields a false
L2; a non-provenance predicate yields 0.

#16 — surface a missing external tool distinctly instead of a silent level 0:
- verifySLSA returns a sentinel errGHMissing when gh is absent (vs gh-ran-and-found-
  nothing). Verify sets result.SLSAToolMissing and, under --min-slsa-level, fails
  closed with a clear reason rather than reporting level 0.
- Document the required tools (cosign, gh, syft) and the fail-closed behavior in the
  verify CLI help and the README (+ a Required external tools table). README
  copyright prose also corrected to Playground Logic LLC.
- internal/sbom went from zero tests to covered: Generate runs syft, --attest runs
  cosign (image only, skipped for local files), missing-syft errors, CycloneDX format.

Tests: slsaLevelFromGH (L2 hosted / L3 generator / wrong-predicate / garbage-no-false-L2);
toolAvailable for a missing tool; the sbom generator suite. go build/vet/test green;
no new deps.
@scttfrdmn
scttfrdmn merged commit 35a4cc7 into main Jun 9, 2026
1 check passed
@scttfrdmn
scttfrdmn deleted the feat/slsa-structural-and-gh-ergonomics branch June 9, 2026 22:10
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.

SLSA level extraction falls back to a hardcoded level 2 heuristic vet verify --check-cves is a no-op: CVE gating silently passes vulnerable artifacts

1 participant