Skip to content

Let a plugin pin its own plugin SDK - #415

Merged
brsbl merged 5 commits into
mainfrom
bb/plugin-sdk-pin-thr_x6wkp5kcx3
Oct 12, 2026
Merged

brsbl merged 5 commits into
mainfrom
bb/plugin-sdk-pin-thr_x6wkp5kcx3

Conversation

@brsbl

@brsbl brsbl commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

What was wrong

This repo requires every plugin to build against one shared plugin SDK, currently 0.5.9. A plugin that needs newer SDK APIs, such as Playgrounds on 0.6.37, can't pass the repo check. Raising the shared pin breaks 13 plugins whose composer APIs SDK 0.6 no longer exports.

What changed

  • Opt-in pin: a plugin may now pin its own plugin SDK by carrying vendor/get-bb-plugin-sdk-<version>.tgz and vendor/sdk-provenance.json. pluginSdkFor in tooling/plugin-sdk-provenance.mjs reads that record, or falls back to the shared pin.
  • Trust root: a pin is valid only for an SDK version listed in tooling/vendor/plugin-sdk-pins.json, which records that version's npm registry integrity. A plugin's own sdk-provenance.json can't vouch for itself: it must match that entry, and the archive must be the npm-published tarball byte for byte. 0.6.37 is the first entry.
  • check-repository: for a pinned plugin, it requires the dependency file:./vendor/<archive> and checks the archive's sha256 against the record and its sha512 against the allowlisted npm integrity. It checks the plugin's engines.bbPluginSdk floor against that plugin's own pin.
  • validate-plugin-artifacts: checks the floor the same way. Artifact metadata still records the shared builder's SDK.
  • Everything else stays the same: plugins without a pin are unaffected, including the shared SDK, the builder, and every other plugin.

This is the bottom of the Playgrounds stack. #405 is the first plugin to use it.

How you verified

  • Remote CI on this branch. Every plugin's check runs unchanged.
  • Slop Cop (security, architecture, code quality and performance) at 8f0c2f2b1. It found one P1: the pin's hash was only compared against a value in the same plugin folder. The allowlist above fixes it. Checked against the real 0.6.37 archive from Add Playgrounds #405: the archive matches its npm integrity, and a record with a forged integrity is rejected.

Follow-ups (P2, not in this PR)

  • pluginSdkFor treats every read error as "no pin". Only a missing file should mean no pin.
  • A pin at the shared 0.5.9 version should be rejected as redundant.
  • publish-install-refs release provenance should record a pinned plugin's own SDK.
  • Add scaffold-smoke cases for the pin paths.
  • Document in tooling/README.md that the builder and app exports still follow the shared SDK.

BB-Thread: Interactive Answers as a built-in plugin

AGENT GENERATED

🤖 Generated with Claude Code

A plugin that needs a newer SDK than the repository pin can carry
vendor/get-bb-plugin-sdk-<version>.tgz and vendor/sdk-provenance.json.
check-repository verifies that archive's sha256 and the plugin's SDK floor
against its own pin; artifact validation checks the floor the same way.
Plugins without a pin keep the shared SDK and builder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brsbl
brsbl added this pull request to stack #417 October 10, 2026 19:30
@brsbl brsbl mentioned this pull request Oct 10, 2026
A plugin's vendor/sdk-provenance.json could vouch for any archive it shipped,
because the expected hash lived next to the archive. Pins are now valid only for
SDK versions listed in tooling/vendor/plugin-sdk-pins.json, and the pinned archive
must match that entry's npm registry integrity byte for byte.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brsbl
brsbl marked this pull request as ready for review October 12, 2026 21:32
@brsbl
brsbl merged commit ee6c598 into main Oct 12, 2026
35 checks passed
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