Skip to content

Track: AI-plugin lock file + Sigstore signing #6300

Closed

Description

@samuv

Summary

Tracks extending the project-level toolhive.lock.yaml (RFC THV-0080) with a sibling plugins: key so project-scoped thv ai-plugin installs are pinned the same way skills are: source, resolvedReference, digest, contentDigest, and Sigstore provenance, plus thv ai-plugin sync / thv ai-plugin upgrade, signature verification on consume, and signing on push.

THV-0080 owns only version and skills:; it reserved sibling keys (explicitly plugins:) as a contract proposal for a later RFC to ratify. This issue ratifies that contract without a new RFC: same file, additive plugins: key, schema version stays 1. Older binaries already round-trip unknown top-level keys via Lockfile.Extra; bumping to version 2 would hard-fail mixed-version teams that only use skills.

This is the AI-plugin counterpart of the skills track (#5899). It copies that trust model rather than inventing one, and reuses the packages skills already landed (pkg/skills/lockfile.Entry including provenance/unsigned, pkg/skills/verifier, pkg/skills/signer, cmd/thv/app/exitcode.go).

The feature is gated behind TOOLHIVE_PLUGINS_LOCK_ENABLED for the whole rollout — plugin entries must not become user-visible in the lock until verification is wired, because by then the lock file is the live skills trust document (#6139 removes TOOLHIVE_SKILLS_LOCK_ENABLED). Pinning and Sigstore are one v1, not two independently shippable halves.

Prerequisite: start Stack 1 only after #6139 (skills push-signing + ungate) is merged to main. Do not stack these PRs on skills-sig/14-push-signing-ungate.

Related: #5899 (skills lock + Sigstore), #5525 (plugin lifecycle epic, RFC THV-0077).

User Story

As a team maintaining a project that consumes AI-tool plugins,
I want project-scope plugin installs pinned in the same committed toolhive.lock.yaml as skills, cryptographically verified against the publisher's Sigstore identity, and safely upgradable,
So that every teammate and CI run restores the exact same reviewed plugins, and tampered or re-signed artifacts are detected before they reach a developer's machine.

Agreed design

  • Same file, additive key, version 1. plugins: sits next to skills:. A skill and a plugin may share a name; they are separate graphs.
  • Full skills parity as one v1: pin on project-scope install, sync / upgrade, verify on consume, sign on push, TOFU provenance / unsigned: true.
  • CLI/API: thv ai-plugin sync / thv ai-plugin upgrade and POST /plugins/sync / POST /plugins/upgrade. Do not teach thv skill sync to walk plugins: — that would change existing CI --check semantics.
  • Lock only explicit plugin installs. requires is parsed today but not materialized; requiredBy / explicit stay unused until that Phase-3 wave. Do not record uninstalled deps.
  • Client-agnostic. No clients field. contentDigest is the frozen skills dirhash over the canonical plugin tree (what ExtractPlugin writes into the client plugin dir), not marketplace.json / settings.json.
  • Reuse, don't extract. Keep pkg/skills/lockfile; add Plugins []Entry plus GetPlugin / UpsertPlugin / RemovePlugin. Validate skills and plugins as separate name/requiredBy graphs. Import existing verifier/signer. Moving signer into toolhive-core stays a Track: Skills lock file + Sigstore signing (RFC THV-0080) #5899 follow-up.
  • Project-scope only, matching THV-0080.
  • Publishing is keyless-only (revised 2026-09-03). Install-time verification is keyless, so a key-signed plugin fails as ErrKeySigned — distinct from ErrUnsigned, so --allow-unsigned cannot override it — and the artifact is uninstallable project-scoped. plugins.PushOptions omits Key entirely rather than accepting a value it would have to reject. A --key flag can only follow install-time key verification (--key push signing has no install-time verification path (plugins) #6442).
  • A signed push publishes nothing unsigned at the requested reference (added 2026-09-03). Signing reads the artifact back from the registry, so publication necessarily precedes it; content is therefore staged under its immutable digest and the tag promoted only once the signature is attached. Digest-pinned destinations are refused for signed pushes, since staging and promotion collapse into one operation and no ordering upholds the guarantee.
  • A stored bundle binds to the artifact digest (added 2026-09-03). A cosign signature covers a simple-signing payload rather than the artifact, so the payload is persisted with the bundle and every verification checks both that the signature covers those bytes and that those bytes name this artifact. Requires toolhive-core#263.
version: 1
skills:
  - name: code-review
    source: code-review
    digest: sha256:...
    provenance: { signerIdentity: "...", certIssuer: "..." }
plugins:
  - name: my-plugin
    source: my-plugin
    resolvedReference: ghcr.io/org/my-plugin:1.0.0
    digest: sha256:...
    contentDigest: sha256:...
    provenance: { signerIdentity: "...", certIssuer: "..." }

Acceptance Criteria

Stack 1 — Lock file

  • AT: Project-scope thv ai-plugin install writes a plugins: entry in toolhive.lock.yaml pinning source, resolvedReference, digest, and contentDigest; thv ai-plugin uninstall removes it. Lock-write failure fails the entire install (rollback DB + dematerialize). (Record plugin installs in the project lock file #6314)
  • AT: thv ai-plugin sync --check detects drift between the lock file and installed plugins (missing, digest mismatch, on-disk tampering via contentDigest) and exits with code 2 on failure (Add plugin lock-file sync #6316)
  • AT: thv ai-plugin sync --adopt records out-of-band installs into the lock; --prune removes lock entries for manually deleted plugins (Add plugin lock-file sync #6316)
  • AT: thv ai-plugin upgrade --preview shows the candidate change without applying; moving to a different resolved reference requires --allow-ref-change (Add plugin lock-file upgrade #6317)
  • AT: Sync and upgrade are exposed via POST /plugins/sync and POST /plugins/upgrade with typed exit codes for CI (0 success / 2 check failure / 3 partial failure / 4 policy rejection) (Add plugin lock-file sync #6316, Add plugin lock-file upgrade #6317)
  • Unit: a skills-only lock still loads; unknown top-level keys still round-trip via Extra; plugin names are unique within plugins: (not across skills:) (Add plugins key to lock file schema #6303)

Stack 2 — Sigstore v1

Delivery

Stack 1 — Lock file mechanics

Branch chain: plugins-lock/01-schema → plugins-lock/05-upgrade, each PR targeting the previous one's branch. Feature gated; no provenance wiring yet (entries written only behind the gate, and Stack 2 lands before ungate).

Each PR includes its own tests (unit + E2E where applicable) and passes CI independently of the rest of the stack.

Stack 2 — Sigstore signing/verification

Branch chain: plugins-sig/06-bundle → plugins-sig/10-push-ungate. Reuse pkg/skills/verifier and toolhive-core's container/signer (#6383 moved skill signing there; pkg/skills/signer no longer exists); no new Sigstore packages.

Minimum toolhive-core: v0.0.43 (carries toolhive-core#263). Below it, offline bundle re-verification cannot succeed for a cosign-signed artifact and signature-to-artifact binding is unchecked. Tagged 2026-09-03 and pinned in #6438 (on main as of the merge); the interim pseudo-version is gone.

Follow-ups (tracked separately once reached)

  • Plugin requires materialization and requiredBy locking (not installed today; a later Phase-3 wave)
  • Sigstore-staging E2E for plugin push (same deferral as skills; keyless OIDC push signing itself landed in Sign plugin pushes and remove the lock feature gate #6438)
  • Catalog-supplied expected identity (needs toolhive-core Provenance on plugin types)
  • Unified thv lock sync that walks both skills: and plugins:
  • Extracting pkg/skills/lockfile / signer into a generic package (signer move into toolhive-core is already sequenced after Track: Skills lock file + Sigstore signing (RFC THV-0080) #5899 PR14)
  • Example repo (skills has stacklok/toolhive-skills-lock-example)

Out of scope (v1)

  • Version-constraint resolution or a toolhive.yaml manifest
  • Per-client pinning (clients field)
  • User-scope lock entries
  • Org-wide signer policy files

Definition of done

Activity

  1. added
    enhancement
    on Aug 13, 2026
  2. self-assigned this
    on Aug 13, 2026
  3. added
    go
    cli
    on Aug 13, 2026
  4. added
    needs-triage
    on Aug 13, 2026
  5. removed
    needs-triage
    on Aug 13, 2026
  6. samuv commented on Aug 13, 2026

    @samuv
    ContributorAuthor

    #6139 is merged. Stack 1 is unblocked.

    PR1 is up: #6303 — plugins: schema on toolhive.lock.yaml (version stays 1). No callers yet; install hooks land in PR3.

  7. samuv commented on Aug 13, 2026

    @samuv
    ContributorAuthor

    Prerequisite met. #6139 is merged, so Stack 1 here is unblocked. main now has no TOOLHIVE_SKILLS_LOCK_ENABLED and no pkg/skills/feature_gate.go, which also means the gating pattern this issue describes for TOOLHIVE_PLUGINS_LOCK_ENABLED has no sibling left to copy — the skills gate and its tests are gone from the tree, so it will need writing fresh rather than mirroring.

    Two pointers in the description are now stale:

    One API change to be aware of when reusing the signer: core's SignOCI returns *Result{Bundle, PayloadDigest}, not []byte, and the payload digest is not the artifact digest — passing the artifact digest to a bundle verifier always fails. Core exports PayloadDigest(ref, digest) for consumers holding only a reference.

    Also relevant to the plugins: design here: thv ai-plugin reached parity with thv skill on two fixes released in v0.42.1 — relative --project-root (#6226) and pull-sized timeouts plus a distinct request-timeout error (#6228). PluginsRouter now has per-route timeouts and the plugins client honours TOOLHIVE_API_TIMEOUT, so sync/upgrade endpoints added here should follow that pattern rather than the flat 60s one.

  8. samuv commented on Aug 13, 2026

    @samuv
    ContributorAuthor

    PR2 is up: #6311 — PluginLockService + installed_plugins.managed. No callers yet; install hooks land in PR3.

  9. samuv commented on Aug 20, 2026

    @samuv
    ContributorAuthor

    Status update — Stack 1 complete.

    All five lock-file mechanics PRs are merged to main:

    All Stack 1 acceptance criteria are checked off in the body. The feature remains gated behind TOOLHIVE_PLUGINS_LOCK_ENABLED as planned — nothing is user-visible until Stack 2 lands and PR10 removes the gate.

    One design note for Stack 2: the body said to reuse pkg/skills/signer, but #6383 has since moved skill signing to toolhive-core's container/signer (and #6385/#6390 are adding keyless identity-token plumbing on top). I've updated the Stack 2 header accordingly — plugin push signing (PR10) should build on the toolhive-core signer, and pkg/skills/verifier is still the verification entry point for PRs 6–9.

    Next: plugins-sig/06-bundle (PR6 — Sigstore bundle persistence for plugin installs + git commit-signature plumbing).

  10. 33 remaining items

  11. added a commit that references this issue on Aug 31, 2026
  12. samuv commented on Sep 1, 2026

    @samuv
    ContributorAuthor

    Status update — Stack 2 is four-fifths merged; only PR10 remains.

    Merged since the last update:

    All Stack 2 acceptance criteria except push signing are checked off in the body. The provenance-xor-unsigned validation criterion was already satisfied by the shared pkg/skills/lockfile validation (in place for plugin entries since #6303), now marked.

    Remaining: #6438 — PR10 (push signing by default via toolhive-core's signer with keyless parity, trust-state display on ai-plugin info/install, arch docs, and removal of TOOLHIVE_PLUGINS_LOCK_ENABLED). CI is green; it's in active review with changes requested. Once it merges, the Delivery checklist and Definition of Done are complete and this issue can close.

  13. samuv commented on Sep 3, 2026

    @samuv
    ContributorAuthor

    Ratifying the Stack-2 push-signing criterion as keyless-only

    Revised the thv ai-plugin push acceptance criterion and the matching follow-up entry, per the review on #6438. Recording the reasoning here rather than leaving the edit unexplained.

    The criterion and the deferral were inverted relative to what shipped. The AC required signing with a cosign key (--key, COSIGN_PASSWORD), while the follow-up list deferred "Keyless OIDC push signing". #6438 delivers keyless and offers no key, so the tracker described neither the design nor the delivery.

    Keyless-only is not a shortcut — a key path would produce artifacts nobody can install. Install-time verification is keyless-only, so a key-signed plugin fails as ErrKeySigned. That verdict is deliberately distinct from ErrUnsigned, which means --allow-unsigned cannot override it and the plugin is uninstallable project-scoped. Accepting --key at push time would let people publish artifacts that every consumer refuses. plugins.PushOptions therefore omits the field entirely, so the unsupported request cannot be constructed by any caller, in-process or over HTTP.

    A plugin --key flag can only follow install-time key verification, which is #6442.

    What changed:

    • The AC now specifies keyless OIDC (--identity-token) and states why key signing is excluded.
    • "Keyless OIDC push signing" is removed from the follow-ups; the Sigstore-staging E2E deferral stays, since that part has not landed.
    • The checkbox is still unchecked and still reads "in review". Ratifying the criterion is not the same as delivering it — Sign plugin pushes and remove the lock feature gate #6438 has not merged.

    Nothing else in the issue is touched, and the previous wording is in the edit history if this reading is wrong.

  14. samuv commented on Sep 3, 2026

    @samuv
    ContributorAuthor

    Bringing the criteria and the stack steps in line with what was actually built

    Second pass on the tracker, beyond the keyless-only ratification above. Three things had drifted from reality; the edit history has the previous wording.

    1. One ticked criterion was not true when it was ticked. "sync --check re-verifies stored Sigstore bundles offline" was marked done at #6399, and it could not have worked for any normally signed OCI plugin. A cosign signature covers the simple-signing payload rather than the artifact, and a bundle persisted on its own carried no payload — so re-verifying it against the artifact digest the lock records always failed, and every signed plugin reported as drift. It is functional from #6438, which bumps to toolhive-core#263. Left ticked with the qualification attached rather than un-ticked, because the code did land in #6399; what was missing was underneath it. Worth noting it was found by review of #6438 and not by the tests that ticked the box.

    2. Two acceptance criteria were missing entirely — both trust properties that came out of reviewing #6438, not new features:

    • A signed push never leaves unsigned content at the requested reference (staged under the digest, signed, then promoted; digest-pinned destinations refused before the first registry call, still allowed under --no-sign).
    • Signature material that signs a different artifact is refused as an invalid signature and never as unsigned, so --allow-unsigned cannot wave a transplanted signature through.

    The matching design decisions are now in Agreed design, alongside keyless-only publishing, so the reasoning is not buried in PR threads.

    3. The size guideline was missed and the box said nothing about it. The 10-PR shape held; the 400-line / 10-file budget did not. Stack 1 stayed inside it. In Stack 2 only #6396 (+161/-30, 7 files) did — #6397 (+1137/-175, 26), #6399 (+597/-50, 17), #6401 (+908/-45, 16) and #6438 (+2635/-527, 60) all exceeded it. That is now stated rather than left as an unchecked box implying it is still pending. A split was offered on #6438 three times and not taken.

    Also recorded: Stack 2 now declares a minimum toolhive-core (the release carrying #263) and the Definition of done requires a tagged release, not the pseudo-version #6438 currently pins. PR10's entry lists the trust-correctness work it picked up in review.

    Delivery items 2 and 3 (docs, gate removal) are implemented in #6438 and left unchecked until it merges, matching how every other box here is used.

  15. samuv commented on Sep 3, 2026

    @samuv
    ContributorAuthor

    Complete — closing

    #6438 merged at 14:04 UTC today, which was the last of the ten PRs and the point the gate came off. Verified against main rather than against the PR list:

    Every acceptance criterion and delivery item is now checked.

    Two things this issue records that are worth carrying forward rather than losing on close:

    1. "sync --check re-verifies stored bundles offline" was ticked at Re-verify stored plugin signatures during sync #6399 and was not true. A cosign signature covers the simple-signing payload, and a bundle persisted alone carried no payload, so re-verification against the locked artifact digest always failed and every signed plugin reported as drift. It became functional only with the toolhive-core#263 bump in Sign plugin pushes and remove the lock feature gate #6438. It was found by review of Sign plugin pushes and remove the lock feature gate #6438, not by the tests that ticked the box — the tests round-tripped a value that made the inconsistency invisible.

    2. The size guideline was missed by four of the five Stack-2 PRs, recorded in the Delivery section with the numbers. The 10-PR shape held; the 400-line / 10-file budget did not, and the verification work did not decompose along the same seams the lock-file work did. Worth weighing when the next trust-model stack is planned.

    Follow-ups stay tracked in the section above and are not blocked by this closing: plugin requires materialization, Sigstore-staging E2E for push, catalog-supplied expected identity, a unified thv lock sync, extracting the lockfile/signer packages, and an example repo. Install-time key verification is #6442, which is what a plugin --key flag depends on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

clienhancementgo

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions