Skip to content

feat(plugin): install provenance + immutable pinning (spore-plugins#8 increment 1) - #398

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/8-plugin-pinning
Jul 19, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/8-plugin-pinning

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

First increment of the registry supply-chain RFC (docs/registry-supply-chain-rfc.md, tracking spore-host/spore-plugins#8). Client-side pinning only — no signing infra, no registry changes.

What

The plugin resolver previously fetched plugin.yaml by mutable ref and discarded all provenance. It now captures:

  • spec_sha256 — sha256 of the exact fetched bytes (always).
  • commit_sha — the immutable commit a tag/branch resolved to, via GET api.github.com/repos/{o}/{r}/commits/{ref} (Accept: vnd.github.sha). Best-effort: a rate-limited/offline API logs a note and leaves it empty — it never blocks an install; the content digest is always recorded.

Surfaced three ways:

  • spawn plugin inspect → a Resolved: line: commit <sha> · sha256 <hex>, or unpinned (commit unknown) · sha256 <hex>, or local file · sha256 <hex>.
  • spawn plugin install → prints the pin.
  • Local install record (~/.spawn/plugins/...json) → stores commit_sha + spec_sha256 for audit.

Non-breaking design

RegistryResolver gains ResolveWithProvenance; the existing Resolve becomes a thin wrapper, so the 4 existing callers (agent, pluginruntime, plus install/inspect which opt in) are untouched. A rawBase/apiBase seam on compositeResolver lets tests drive both endpoints via httptest — no network in tests.

Tests

pkg/plugin/registry_provenance_test.go: commit-SHA pinning on 200, best-effort empty SHA + no error when the API fails, content-hash stability, isHexSHA. Existing inspect tests updated for the new Resolved: line.

Scope (later increments, #8 stays open)

Signing (cosign/sigstore), checksum manifests, fetch-step sha256:, on-instance/EC2-tag recording — all deferred per the RFC.

Refs spore-host/spore-plugins#8

…ugins#8)

First increment of the registry supply-chain RFC. The resolver now
captures provenance for every resolved plugin:

- sha256 of the exact plugin.yaml bytes (always).
- the immutable commit SHA a tag/branch resolved to, via the GitHub
  commits API — best-effort: a rate-limited/offline API logs a note and
  leaves the commit empty, never blocking the install. Content digest is
  always recorded.

Surfaced in `spawn plugin inspect` (a `Resolved:` line), printed by
`spawn plugin install`, and stored (commit_sha + spec_sha256) in the
local install record for audit.

Non-breaking: RegistryResolver gains ResolveWithProvenance; the existing
Resolve is now a thin wrapper (4 callers untouched). A rawBase/apiBase
seam on compositeResolver lets tests drive it via httptest with no
network.

Signing, checksum manifests, fetch-step digests, and on-instance/tag
recording remain later increments (spore-plugins#8 stays open).

Refs spore-host/spore-plugins#8
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.24409% with 67 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/plugin/registry.go 47.31% 39 Missing and 10 partials ⚠️
cmd/plugin.go 0.00% 11 Missing ⚠️
cmd/plugin_inspect.go 69.56% 5 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 97122b5 into main Jul 19, 2026
6 of 7 checks passed
@scttfrdmn
scttfrdmn deleted the feat/8-plugin-pinning branch July 19, 2026 16:54
scttfrdmn added a commit that referenced this pull request Aug 1, 2026
* chore(deps): bump substrate test dependency to v0.81.0

Test-only; no runtime or API change (root + lambda/dns-updater).

The reason to take it now is substrate#412: RunInstances previously accepted an
empty ImageId and launched an instance, so our guard against launching without a
resolved AMI had no offline test that could fail -- the bug we filed it for
shipped, and was caught only by a paid smoke test against real AWS. Substrate now
returns MissingParameter / HTTP 400 when no AMI resolves from any source
(request or launch template), so that path is reachable in -short tests.

Fixing it also surfaced a substrate request-parser defect: an explicitly-empty
query-protocol body parameter was coerced to the bare-key sentinel "1", so
ImageId= arrived as the string 1 and launched from an AMI named 1 -- affecting
every EC2/IAM/STS/SQS/SNS parameter sent empty.

Also newly testable offline: Invalid*ID.NotFound for explicit EC2 IDs (#391),
symbolic Error.Code per service (#392), Lambda invoke omitting FunctionError and
LogResult (#393), S3 Range and conditional requests (#396, #397),
x-amz-checksum-* verification (#399), storage classes and CopyObject metadata
directives (#398), Content-Encoding surviving a multipart upload (#406), and a
seedable SQS create-then-lookup consistency window with the correct
QueueDoesNotExist code -- the legacy dotted form was uncatchable as a typed
error in either SDK, which is what the taskpool queue-lifecycle tests assert on
(#413).

Note: cmd's TestCatalogValid fails on main already (two private ECR images in
the shipped app catalog, #392) and is unrelated to this bump.

* fix(ttl-reaper): bump accountlifecycle past the substrate import move

The Security job on this branch (and on main — this is not PR-introduced) failed
with `go: updates to go.mod needed` in lambda/ttl-reaper. Cause is Go MVS plus
upstream tag timing, not any commit here:

  ttl-reaper requires spore-host/lambda/accountlifecycle at a pseudo-version
  whose *test* imported substrate at its old root path. Substrate moved that
  package to /emulator in v0.70.0, so once v0.80.0 (2026-08-01 02:11Z) and
  v0.81.0 (06:12Z) were tagged — after spawn main's last green Security run
  (2026-07-31 17:52Z) — resolution broke with no local change involved.

#509 fixed the import; this bumps the pin to that merged commit
(14e273c). Verified: `go mod tidy -diff` clean, `go build ./...` clean, and
govulncheck (v1.3.0, as CI pins) reports no vulnerabilities.

Note the go.sum-only tidy drift in alert-handler, autoscale-orchestrator and
sweep-orchestrator is pre-existing on main and does not affect govulncheck,
which is what the job actually runs. Left alone here to keep this fix scoped.
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