Repository navigation
feat(plugin): registry discovery — search, info, and a generated index - #451
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Jul 29, 2026
Contributor
Author
|
Trivy fails here for CVE-2026-56852 in Fixed separately in #452 (all green). Once that merges, rebasing this branch clears the failure. Every other check here passes: Test, E2E Tier 0, Semgrep, gitleaks, Go Vulnerability Check, codecov/patch. |
…index Closes the discovery half of #448. Resolution could already answer "fetch the plugin named X", but nothing could answer "what plugins exist": you had to know a name in advance, and a typo was indistinguishable from a plugin that had never been written, since both surfaced as a 404. - `spawn plugin search [query]` lists the official registry, matching names and descriptions, and flags a plugin that wants root before you install it. - `spawn plugin info <name>` shows version, description, config keys (marking required ones), and declared capability surface, suggesting near-matches on a miss. It only prints a capability line the spec actually declared — silence means "not declared", never "declares no root". - `spawn plugin gen-index` (hidden) is the generator, in the same arrangement as `spawn plugin manifest`: it lives here and the registry's CI invokes it, so the index is derived by the same parser that installs plugins and cannot describe a spec differently from the spec itself. `--generated-at` takes the commit time so regenerating an unchanged registry is byte-identical and CI commits no churn. The index is cached under ~/.spawn/cache with a 6h TTL, and served when the network is unreachable rather than failing — but every listing prints where it came from and how old it is, and an offline fallback warns explicitly. A cached index that is merely old is useful; one that silently pretends to be current is not. Nothing here is a security boundary: install independently fetches and verifies the real plugin.yaml, so a poisoned cache can at worst misdescribe a listing, never cause different code to run. Scope is the official registry only. Signature verification is pinned to the spore-plugins release workflow's OIDC identity (officialSigSANRegex), so a third-party entry could never be backed by the trust signal a `verified` field implies, and listing one would make `verified: false` an endorsement with nothing behind it. Deferred deliberately, not overlooked. Also pins resolved registry URLs by test. The official registry keeps specs at plugins/<name>/plugin.yaml while a third-party github: repo keeps <name>/plugin.yaml at its root; the existing provenance test matched a suffix both layouts satisfy, so neither was pinned and a regression would have surfaced only as an install-time 404. Tightened that assertion and added exact-path coverage for both layouts, the versioned-tag path, and traversal rejection. Moving component validation ahead of the unverified-source warning also stops a ref we're about to reject from being announced as one we're installing.
`gen-index` was Hidden, which made it undetectable: cobra falls through to `plugin --help` for an unknown subcommand and exits 0, so a registry CI probing `plugin gen-index --help` to decide whether the released spawn supports it would get a pass from a binary that doesn't. Caught by the companion spore-plugins PR, whose guard passed and then failed on `unknown flag: --source`. Unhiding also matches `plugin manifest`, the other registry-side generator invoked by that repo's CI, and gives the probe something to grep for — the same technique lint.yml already uses to detect `validate --strict`.
scttfrdmn
force-pushed
the
feat/plugin-discovery-index
branch
from
July 29, 2026 17:11
b630ed0 to
a7a6534
Compare
scttfrdmn
added a commit
to spore-host/spore-plugins
that referenced
this pull request
Jul 29, 2026
* feat(index): publish a generated discovery index Adds index.json — the manifest `spawn plugin search` and `spawn plugin info` read — plus the CI that keeps it current. Registry half of spore-host/spawn#448; the commands themselves are spore-host/spawn#451. The index is derived from the specs by `spawn plugin gen-index`, never hand-edited, so it cannot describe a plugin differently from its plugin.yaml. As with lint.yml, spawn is the single source of truth for spec rules and this workflow reimplements none of them. index.yml regenerates on any push touching plugins/*/plugin.yaml and commits the result back to main. On a pull request it checks the committed index instead of pushing — a fork can't push, and a spec change should be reviewed together with the index entry it produces. generatedAt is stamped from the last commit to a SPEC, not from HEAD or from "now". HEAD would be circular: committing the index moves HEAD, which changes the stamp, so the index could never be current with itself and every run would commit a no-op diff. Keying off the specs makes generation idempotent — verified here by regenerating twice for byte-identical output, and the committed index carries the stamp the workflow will compute, so its first run finds nothing to do. Docs: README gains a "Finding a plugin" section pointing at the commands, since its hand-kept table lists 4 of the 12 plugins here and that drift is what a generated index removes. AUTHORING gains the mapping from spec fields to what discovery shows, because description, config types/required, and permissions.instance.{root,ports} are now user-facing before install — and a spec that omits permissions shows nothing rather than "needs nothing", so declaring them accurately is how users get an honest picture. * fix(index): probe for gen-index by grepping plugin help `gen-index --help` is not a usable capability probe: on a spawn that lacks the subcommand, cobra falls through to `plugin --help` and exits 0, so the guard passed against a binary that then failed on `unknown flag: --source`. Grep the parent help instead, as lint.yml already does for `validate --strict`. Verified against the currently released spawn (v0.36.12): the probe correctly reports no support and fails fast with the actionable message.
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 the discovery half of #448.
The problem
Resolution could already answer "fetch me the plugin named X." Nothing could answer "what plugins exist?" — you had to know a name in advance, from the registry README or word of mouth. Worse, a typo and a plugin that had never been written were indistinguishable: both surfaced as an identical 404.
What this adds
spawn plugin search [query]— lists the official registry, matching the query against names and descriptions, name hits first. Flags a plugin that wants root, since that's the most consequential thing about a plugin you haven't installed yet.spawn plugin info <name>— version, description, config keys with required ones marked, and declared capability surface. Suggests near-matches on a miss, which is the other half of what the index is for (plugin info jupyter→ "did you mean: jupyterlab").It only prints a capability line the spec actually declared. Silence means "not declared" — printing
root: nofor a plugin whose spec omitspermissionswould assert something the spec never said.spawn plugin gen-index(hidden) — the generator, in the same arrangement asspawn plugin manifest: it lives here, and the registry's CI invokes it. That way the index is derived by the sameParseSpecthe installer uses and cannot describe a spec differently from the spec itself, and spore-plugins' CI keeps its rule of never reimplementing spec logic.--generated-attakes the commit time, so regenerating an unchanged registry is byte-identical and CI commits no churn (there's a test for that; config params come from a map, so it was a real risk).Design notes
~/.spawn/cache, served when the network is unreachable rather than failing, soplugin searchworks on a plane. But every listing prints its provenance and age, and the offline fallback warns explicitly. A cached index that is merely old is useful; one that silently pretends to be current is not.plugin.yaml. A poisoned cache can at worst misdescribe a listing — never cause different code to run.Scope: official registry only, deliberately
officialSigSANRegexinpkg/plugin/signature.gopins signature verification to the spore-plugins release workflow's OIDC identity. A third-party plugin therefore cannot be signature-verified as spawn is currently built. So a third-party index entry could never be backed by the trust signal averifiedfield implies, and listing one would make `verified: false` an endorsement with nothing behind it. Deferred as a separate decision, not overlooked — it needs a trust model first (PR review, commit-SHA pinning, or a distinct third-party signing path).Also: registry URLs are now pinned by tests
Found while working on the resolution path. The official registry keeps specs at `plugins//plugin.yaml`; a third-party `github:` repo keeps `/plugin.yaml` at its root. The existing provenance test asserted `strings.HasSuffix(path, "/demo/plugin.yaml")` — which passes for both layouts, so neither was actually pinned and a regression in either would have surfaced only as an install-time 404 in the field.
Tightened that assertion to an exact path and added
registry_specpath_test.gocovering both layouts, the versioned-tag path ([email protected]→ fetched at thedemo-v1.0.0tag, not main), and traversal rejection — including that validation happens before any request is issued.One small behavior fix falls out: component validation now runs ahead of the "installing plugin from unverified source" warning, so a ref we're about to reject is no longer announced as one we're installing.
Verification
make checkgreen; the lint findings printed are pre-existing in files this PR doesn't touch (cmd/bot.go,cmd/launch_preflight.go,pkg/aws/windows_password.go).--generated-atproduced byte-identical output.--output jsonon both, and the offline stale-cache fallback (which correctly reported cache age 209d separately from index generation time). The primed cache was removed afterward; no residue.Follow-up
index.jsondoesn't exist upstream yet, so until the companion spore-plugins PR (index workflow + initial index) lands, these commands report that the registry hasn't published an index and point out that installing by name still works. That PR comes next, since its CI consumes a released spawn binary.