You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two related gaps in the plugin HTTP surface block a natural file-transfer design for plugins:
Local-auth multipart uploads are rejected before dispatch. Plugin mutation routes registered through bb.http reject multipart/form-data bodies at the trust boundary, even for trusted local-auth callers. A plugin that needs to accept file uploads (PDFs, spreadsheets, firmware sidecar documents) has no supported binary ingest path.
Plugin routes match exact paths only. There is no parameterized segment support (e.g. GET /documents/:sha256/content), so content-addressed retrieval routes must either enumerate exact paths or tunnel the identifier through query parameters.
Use case
The Finite State plugin's documents lane (spec sheets, PDF/CSV/XLSX evidence with extraction citations) originally specified multipart upload plus GET /documents/<sha256>/content. Both were blocked at integration 056899c2d. The owner-approved interim workaround now shipping is:
Upload via a versioned JSON envelope with base64-encoded content ({ envelopeVersion: 1, filename, contentBase64, sha256, ... }) — accepted costs: ~33% payload inflation and no browser-native streaming.
Retrieval via an exact-match route with the sha256 digest as a query parameter.
Ask
Allow multipart/form-data on trusted local-auth plugin mutation routes (or provide an equivalent streaming binary ingest seam).
Support parameterized path segments in plugin HTTP route registration.
The plugin's envelope is versioned specifically so that when these land, native multipart/path-param transport can be added as envelope v2 without contract churn on the plugin side.
Same root cause as this issue's second ask, different symptom, with a prototype.
The symptom. A plugin cannot serve a directory. Mine gives each session an HTML page in
thread storage — index.html plus its own stylesheet, images and data, referenced relatively, so
the page is an ordinary static site. That needs one route to answer for every file under a prefix,
and the plugin cannot know the filenames in advance, so enumerating exact registrations is not
available even in principle. Live probe on 0.42.1:
GET /api/v1/plugins/thread-pages/http/page/thr_9ai8pirnif/x.css
→ 404 {"error":"plugin \"thread-pages\" has no GET route for …"}
I work around it, and the workaround is fine to keep: the plugin resolves each relative reference
when it serves the document and carries the file inside it as a data: URL. What that cannot give
a plugin is a real site — page script still cannot fetch() its own files, every file counts
against the document's size, and a plugin author has to build the resolver in the first place.
Serving through bb core's thread-storage route instead does not help fetch() either: a sandboxed
document sends Origin: null, and bb core routes answer 403 to it because browserRequestProblem
cannot parse "null".
Where the exactness lives, for whoever picks this up:
A registered path may end in /* and match by prefix; exact wins first, then the longest prefix.
Three things in it worth a maintainer's opinion, because I had to make the calls myself:
It solves prefixes, not :param. Trailing /* covers "serve this directory"; it does not
cover GET /documents/:sha256/content from the original report. One mechanism could cover
both, and if you would rather have parameterized segments as the primitive, this branch is the
wrong shape and should be redone rather than merged alongside.
The matcher is deliberately not Hono's. Hono's own /page/* matches /page; this does
not. The rule lives in packages/plugin-sdk/src/internal/host-policy.ts — the module the real
host and createFakePluginHost already share — and the check that rejects * anywhere but a
final /* segment sits in its normalizeHttpRouteRegistration, so both hosts follow one rule
by construction rather than by two implementations agreeing.
The part I would push back on if I were reviewing. Handlers read the remainder from context.req.path; no new API. For that to be true offline, createFakePluginHost's fetchHttp now dispatches at the path bb really mounts
(/api/v1/plugins/<id>/http<path>) instead of a bare relative path — so req.path and req.url change shape for every plugin's fake-host HTTP tests, not just prefix ones. I
checked every in-repo consumer: none reads req.path, req.url or req.param, only req.query(), which is preserved, and all their suites pass. An out-of-repo plugin asserting
on c.req.path would see a change. The alternative was leaving the fake host lying about the
path, which defeats the point of the feature.
Also updated: the SDK doc comments, the Plugin Guide's bb.http section and two stale "exact-path
HTTP" strings; and experimental_websocket no longer claims its matching is "identical to HTTP
routes", since websockets stay exact-only.
Verified on 9e16411: @get-bb/plugin-sdk 24 files / 279 tests pass; apps/server test/services/plugins 43 files / 492 tests pass (main alone: 489 — the branch adds 3);
typecheck passes for both packages. (Running the server
suite locally needs a fresh SDK build first, and fails in git tag fixtures if your git config
has tag.gpgsign=true.)
One note for the docs either way: a route that serves sandboxed documents has to use auth: "none" and validate the request itself, because auth: "local" refuses the Origin: null such a document sends. That is worth stating alongside whatever lands here — I
added it to the SDK doc comment and the guide in the branch.
Related: over bb Connect a sandboxed document cannot load its own files at all, and the fix for
that has to carry a credential in the URL path, which is only serveable once prefix routes exist.
Filed as #3617.
I am not on .github/APPROVED_CONTRIBUTORS, so no PR — the branch is there as a prototype.
Activity
docs: draft AMD-0026 WP-56 transport revision (envelope upload, query…
BartSoj commentedon Sep 13, 2026
Same root cause as this issue's second ask, different symptom, with a prototype.
The symptom. A plugin cannot serve a directory. Mine gives each session an HTML page in
thread storage —
index.htmlplus its own stylesheet, images and data, referenced relatively, sothe page is an ordinary static site. That needs one route to answer for every file under a prefix,
and the plugin cannot know the filenames in advance, so enumerating exact registrations is not
available even in principle. Live probe on 0.42.1:
I work around it, and the workaround is fine to keep: the plugin resolves each relative reference
when it serves the document and carries the file inside it as a
data:URL. What that cannot givea plugin is a real site — page script still cannot
fetch()its own files, every file countsagainst the document's size, and a plugin author has to build the resolver in the first place.
Serving through bb core's thread-storage route instead does not help
fetch()either: a sandboxeddocument sends
Origin: null, and bb core routes answer 403 to it becausebrowserRequestProblemcannot parse
"null".Where the exactness lives, for whoever picks this up:
bb/apps/server/src/services/plugins/plugin-service.ts
Lines 1712 to 1719 in 9e16411
Prototype: https://github.com/BartSoj/bb/tree/feat/plugin-prefix-http-routes — one commit on
9e16411.A registered path may end in
/*and match by prefix; exact wins first, then the longest prefix.Three things in it worth a maintainer's opinion, because I had to make the calls myself:
:param. Trailing/*covers "serve this directory"; it does notcover
GET /documents/:sha256/contentfrom the original report. One mechanism could coverboth, and if you would rather have parameterized segments as the primitive, this branch is the
wrong shape and should be redone rather than merged alongside.
/page/*matches/page; this doesnot. The rule lives in
packages/plugin-sdk/src/internal/host-policy.ts— the module the realhost and
createFakePluginHostalready share — and the check that rejects*anywhere but afinal
/*segment sits in itsnormalizeHttpRouteRegistration, so both hosts follow one ruleby construction rather than by two implementations agreeing.
context.req.path; no new API. For that to be true offline,createFakePluginHost'sfetchHttpnow dispatches at the path bb really mounts(
/api/v1/plugins/<id>/http<path>) instead of a bare relative path — soreq.pathandreq.urlchange shape for every plugin's fake-host HTTP tests, not just prefix ones. Ichecked every in-repo consumer: none reads
req.path,req.urlorreq.param, onlyreq.query(), which is preserved, and all their suites pass. An out-of-repo plugin assertingon
c.req.pathwould see a change. The alternative was leaving the fake host lying about thepath, which defeats the point of the feature.
Also updated: the SDK doc comments, the Plugin Guide's
bb.httpsection and two stale "exact-pathHTTP" strings; and
experimental_websocketno longer claims its matching is "identical to HTTProutes", since websockets stay exact-only.
Verified on
9e16411:@get-bb/plugin-sdk24 files / 279 tests pass;apps/servertest/services/plugins43 files / 492 tests pass (mainalone: 489 — the branch adds 3);typecheck passes for both packages. (Running the server
suite locally needs a fresh SDK build first, and fails in
git tagfixtures if your git confighas
tag.gpgsign=true.)One note for the docs either way: a route that serves sandboxed documents has to use
auth: "none"and validate the request itself, becauseauth: "local"refuses theOrigin: nullsuch a document sends. That is worth stating alongside whatever lands here — Iadded it to the SDK doc comment and the guide in the branch.
Related: over bb Connect a sandboxed document cannot load its own files at all, and the fix for
that has to carry a credential in the URL path, which is only serveable once prefix routes exist.
Filed as #3617.
I am not on
.github/APPROVED_CONTRIBUTORS, so no PR — the branch is there as a prototype.