Skip to content

feat(plugin): optional sha256: on fetch steps, verified by spored - #418

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/8-fetch-sha256
Jul 20, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/8-fetch-sha256

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Increment 1 of the registry supply-chain RFC (spore-plugins#8).

What

Adds an optional `sha256:` field to a plugin `fetch` step. When set, spored
hashes the downloaded bytes while writing and fails the install (removing the
file) on a mismatch
— closing the "unverified transitive download" gap for a
fetch URL that (unlike the pinned `plugin.yaml`) is not itself covered by the
registry provenance digest.

  • `pkg/plugin/spec.go` — new optional `SHA256` field on `Step` (`yaml:"sha256,omitempty"`).
  • `pkg/plugin/validate.go` — rejects a `sha256` that isn't 64 lowercase hex chars, or one set on a non-`fetch` step.
  • `pkg/pluginruntime/remote_executor.go` — `fetch` hashes via `io.MultiWriter`; on mismatch closes + removes the file and errors.
  • `cmd/plugin_inspect.go` — `fetch` steps now render `(sha256 abc123…)` or `(unverified — no sha256)`.

Optional in the spec; the registry's publish-time CI (increment 5) will require it on official plugins' `fetch` steps.

Tests

  • 3 validate cases (bad hex, uppercase, non-fetch step).
  • Executor test against a live TLS server: match writes the file, mismatch errors + removes the file, no-checksum downloads normally.
  • gofmt/vet clean, semgrep 0 findings.

Refs #8 (spore-plugins). Keeps the issue open — further increments (manifest, signing, on-instance provenance, publish-time permission check) follow.

…ore-plugins#8)

Add an optional sha256: field to the plugin Step struct. When a fetch step
declares it, spored hashes the downloaded bytes while writing and fails the
install (removing the file) on a mismatch — closing the unverified-transitive-
download gap for a fetch URL not covered by the plugin.yaml provenance digest.

Validate rejects a sha256 that isn't 64 lowercase hex chars, or one set on a
non-fetch step. plugin inspect now shows whether each fetch step is checksummed.

Increment 1 of the registry supply-chain RFC (spore-plugins#8).
@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/plugin_inspect.go 25.00% 2 Missing and 1 partial ⚠️
pkg/pluginruntime/remote_executor.go 90.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn

Copy link
Copy Markdown
Contributor Author

Real-AWS smoke ✅ (gated: TTL 30m, profile spore-host-dev, acct 435415984226)

Launched a t3.small in us-east-1, hot-swapped the branch-built spored onto it (verified sha256sum /usr/local/bin/spored matched the local build exactly — released v0.85.0 lacks this code), and ran two spawn plugin installs of a plugin whose sole install step is a fetch of a pinned immutable file (raw.githubusercontent.com/golang/go/go1.22.0/VERSION, true digest 859f1d57…c91699):

  • Correct sha256: → install succeeded; file present on the instance with matching content + digest.
  • Wrong sha256: (all-zeros) → install failed with:
    step[0] type=fetch: fetch …VERSION: sha256 mismatch (want 0000…, got 859f1d57…)
    and the partial download was removed (/tmp/sha-smoke-bad.txt absent afterward) — no unverified bytes left for a later step.

Instance terminated; independent leak-check clean (0 running/pending/stopping/stopped in the account); S3 staging object deleted. Cost < $0.05.

@scttfrdmn
scttfrdmn merged commit f43fc57 into main Jul 20, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/8-fetch-sha256 branch July 20, 2026 19:01
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