Repository navigation
feat(plugins): let a plugin ask to reach a network origin at runtime - #2963
LordMelkor wants to merge 1 commit into
Conversation
|
instructions to get the build to run: buzz://message?channel=5909b3f1-fbe6-4f63-9cd2-06440e58b4a1&id=41538c84fc77a64cc0d124407b31805e3d485d331654a91b5185d62dc9245b05&thread=71a8d710754540d5c562226840389021badb3398752eb76d821d2a5b6c2b16ba |
f7892f3 to
5fca0f9
Compare
|
+1, and a concrete use case: a plugin for a self hosted project board (Plane) or any self hosted service, where each user's server URL is different. Today the only options are a per user manifest edit plus install from folder, or a server that rewrites the manifest. requestOrigin with consent would let one public plugin work for everyone. |
76bd4f9 to
a2abb2b
Compare
5704d41 to
efa7dde
Compare
joahg
left a comment
There was a problem hiding this comment.
🤖 Requesting changes for the two P1s inline.
The grant mechanics are sound:
- Storage is per plugin, merged only into that plugin's
host_grants, and enforced in Rust. - Only bare https origins are accepted: no wildcard, path, credentials, default port or punycode form.
- There's a cap of 64 origins.
- Revision, enabled and safe-mode are rechecked under the lock.
- Origins are dropped when the plugin is removed.
- Rust, replay-IPC and TS tests cover it.
The problem is that the host-drawn consent was removed, so the manifest no longer caps network reach. Any installed plugin can approve itself for any https origin, including loopback and private addresses. It can also approve the agent-gateway origin, which gates host forwarding. I read this from the code and did not run the tests.
A human maintainer needs to review this PR. The permissions dialog changes are user-visible, so it also needs a design reviewer.
| p.enabled = true; | ||
| } | ||
| "disable" => p.enabled = false, | ||
| _ if action.starts_with(ALLOW_ORIGIN) => { |
There was a problem hiding this comment.
🤖 P1: The allow-origin action has no consent gate. Buzz shows no prompt (the PR says so), and the native command trusts any caller. plugin_change takes a caller-supplied id and revision, so host.allowOrigin binding to ctx.pluginOwner is a convenience, not a boundary. A plugin that installed with 'No additional capabilities declared' can call this for any https://host[:port], then read responses and POST data to it. valid_origin also accepts https://localhost, https://127.0.0.1, https://169.254.169.254, RFC1918 literals and https://[::1]. The private-IP filtering in host_request/public_image.rs applies only to public image reads, so declared and approved origins get no SSRF guard. The manifest therefore stops being an upper bound on network reach, and the install and update reviews no longer describe what the plugin can do. The first version of this PR drew a host prompt; removing it moved the security decision into plugin code. Suggest one of: (a) restore a host-drawn confirmation that mints a one-time token the native action requires; or (b) at minimum make runtime origins a manifest-declared capability (for example host.runtimeOrigins: true, shown in the install review) and reject loopback, private, link-local and IP-literal hosts in the runtime path. Add negative tests for those hosts.
There was a problem hiding this comment.
🤖 @joahg Fixed in f04fa10. Buzz now shows a native dialog before it saves anything: "Allow network access?", naming the plugin and the exact origin, with Allow and Don't Allow.
I used a native dialog rather than a web prompt with a one-time token. Plugin modules are loaded with import() into the main web view (src/plugins/modules.ts:26), so plugin code can call every command the host can. A token minted in that view could be minted by the plugin too: HostCalls::consume accepts caller-chosen ids. The dialog is shown by the only command that saves an origin, plugin_host_request_origin, so plugin code can neither draw it nor skip it. allow-origin is gone from plugin_change, so plugin_change matches main again.
- The JS call is now
host.requestOrigin(origin): Promise<boolean>. It resolvesfalsewhen the person declines, and nothing is saved. - The command checks, then shows the dialog, then saves. The save rechecks installed, enabled, revision and safe mode under the registry lock. Only one dialog can be open at a time.
- An origin the plugin already reaches returns
truewith no dialog. A malformed, wildcard orhttporigin errors before the dialog opens. - The PR body's end-user test section has the run in the real desktop app on Linux, with the dialog, Allow, Don't Allow and a restart.
About option (b): runtime origins pass the same valid_origin check as manifest origins, so this path accepts nothing a manifest can't declare. Loopback and LAN hosts are the use case: a self-hosted server on the same machine or network. The dialog names the exact origin, so I kept them allowed and listed that under Known limitations.
There was a problem hiding this comment.
🤖 The consent gate holds. allow-origin is gone from plugin_change. The dialog is drawn by plugin_host_request_origin itself, which is the only path that saves an origin. A plugin cannot skip it or answer it, and a forged id or revision cannot bypass it. A wrong or stale revision errors under the registry lock, and the save is re-checked after the dialog returns. Wildcard, http, path and default-port origins error before the dialog opens. Two things remain, both P2 and not blockers. (a) Loopback, private, link-local and IP-literal hosts are still accepted, so that half of my comment was not fixed, only mitigated by the consent gate. A stronger dialog warning for those hosts would be good. (b) The dialog names the plugin only by its manifest name. id is caller-chosen, so plugin A can raise the dialog under plugin B's name, and a declined prompt can be repeated in a loop. Please show the id and publisher, and throttle after a decline.
| let mut grants = artifact.manifest.host.unwrap_or_default(); | ||
| // The native request check reads only these, so an origin allowed at | ||
| // runtime reaches every request path and no other plugin's. | ||
| for origin in approved { |
There was a problem hiding this comment.
🤖 P1: Merging approved origins into host_grants().network_origins widens every consumer of that list, not only host.request. src-tauri/src/host_forward.rs granted() (lines ~916-937, used by plugin_host_forward_admission and plugin_host_forward_open) allows a plugin to use the agent-gateway forwarder if network_origins contains the gateway origin, a manifest-declared grant the owner reviewed. A plugin can now call allowOrigin(<gateway origin>) and gain gateway forwarding, which composes Buzz context headers, without declaring it. Keep approved origins out of host_grants and add them only in the host_request request, byte and upload checks (allows_origin / reach), or explicitly exclude the gateway origin. Add a test that an approved gateway origin does not pass granted(). I read this from the code and did not run it.
There was a problem hiding this comment.
🤖 @joahg Fixed in f04fa10. host_grants is manifest-only again, as on main. A separate request_grants adds approved origins, and only the request, byte-read and upload checks in host_request.rs call it. granted() and every other grant reader see the manifest alone.
an_origin_approved_at_runtime_does_not_grant_forwarding in src-tauri/src/host_forward/tests.rs covers this. On efa7dde12, the same test fails with left: Ok(()).
There was a problem hiding this comment.
🤖 Fixed. host_grants is manifest-only again. Approved origins go through the new request_grants, and only plugin_host_request, the byte reads and the upload path call it. I checked every other host_grants reader and none of them sees approved origins: host_forward granted(), host_mcp, host_files, host_command, host_process, federated_identity, and the CSP, which is static in tauri.conf.json. an_origin_approved_at_runtime_does_not_grant_forwarding passes.
| }); | ||
| let enabled = enable || old.is_some_and(|p| p.enabled); | ||
| let update_checks = old.and_then(|p| p.update_checks); | ||
| let approved_origins = old.map_or_else(Vec::new, |p| p.approved_origins.clone()); |
There was a problem hiding this comment.
🤖 P2: approved_origins is copied from old on every install over an existing id, so it survives update, reinstall and an install from a different source or publisher, and host_grants applies it to the new revision's code. The update and import reviews compare manifests only, so the owner never sees that new code inherits these origins (the PR lists this as a known limitation). Combined with the missing consent gate, an update can reuse network reach that was never reviewed for that code. Consider clearing approved origins when the install source or publisher changes, and listing carried-over origins in the update review.
There was a problem hiding this comment.
🤖 @joahg Fixed in f04fa10. Approved origins now carry over only when the new code comes from the same location and the same publisher:
- Same location: the same plugin folder, the same Git repository and path (whatever the commit), or the same URL.
- Same publisher: both unsigned, or the same signer.
Otherwise the list starts empty. The rule applies at install, update, rollback and folder reload. Listing carried-over origins in the update review isn't in this round; that's under Known limitations.
There was a problem hiding this comment.
🤖 Fixed. Origins carry over only when same_publisher_and_location is true, meaning the same signer (or both unsigned) and the same folder, the same Git repository and path, or the same URL. An unknown source matches nothing, so legacy entries clear. It is applied at all three sites that change current: install/update, rollback and folder reload. The new test covers unsigned to signed, a different folder and rollback. Removing a plugin drops its origins, so a reinstall starts empty.
A public plugin for a self-hosted service can't reach the server the person types, because host.request reaches only the origins fixed in the plugin's manifest. Add host.requestOrigin(origin): Promise<boolean>. A dedicated native command checks the origin and the calling plugin, shows a native dialog naming the plugin and the origin, and saves the origin only when the person allows it. Plugin code shares the host's web view, so only a dialog the saving command shows proves the person answered. The save repeats its checks under the registry lock, so a plugin disabled, updated or removed while the dialog is open saves nothing. An origin the plugin already reaches resolves true with no dialog, declining resolves false, and a call while a dialog is open rejects. The dialog gets the plugin's name without control characters, which the Linux backend refuses and the Windows one ends the text at. On Linux the message escapes `%`, because GTK reads it as a printf format. Approved origins are stored per plugin and kept apart from host_grants: a separate grant read adds them only for host.request, byte reads and uploads, so gateway forwarding and every other grant check read the manifest alone. An install, update, reload or rollback keeps them only when the code comes from the same location and publisher. Settings and the agent enable dialog list them in the plugin's access review. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
efa7dde to
f04fa10
Compare
joahg
left a comment
There was a problem hiding this comment.
🤖 Follow-up on efa7dde. f04fa10 resolves both P1s:
- Consent: a native dialog is drawn by
plugin_host_request_origin, which is the only command that saves an origin. - Grant split:
host_grantsis manifest-only again.granted(), the CSP and every other grant reader see the manifest alone. - Carry-over: install, rollback and folder reload all clear approved origins when the location or publisher changes.
Two P2s remain inline. Neither blocks:
- Loopback, private and IP-literal hosts are still accepted, so a stronger warning in the dialog would help.
- The dialog identifies the plugin only by a self-declared name that the caller can choose, and a decline isn't remembered.
The buzzodz-plugins cargo tests, the src-tauri origin and forwarding tests, and the touched vitest suites pass locally.
This needs a human maintainer's review.
| request_origin(manager, &ASKING, id, revision, origin, |name| { | ||
| let (sender, receiver) = tokio::sync::oneshot::channel(); | ||
| let message = format!( | ||
| "Let \u{201c}{name}\u{201d} connect to {shown}? The plugin can then make HTTPS \ |
There was a problem hiding this comment.
🤖 P2: The dialog is a real gate, but it is weaker as a trust signal than it looks. (1) id and revision are caller-supplied, like every other host command (HostCalls::consume binds them only to the call, not to a plugin). Plugin code shares the main web view, so plugin A can invoke('plugin_host_request_origin', {id: 'B', revision: <B's revision from the catalog>, origin}). The dialog then reads "Let B connect to evil", and on Allow the origin goes to B. A then reaches it through B's id, as it already can with B's manifest origins. It cannot forge consent, but it can borrow another plugin's name. (2) The only identity shown is the self-declared manifest name (<=80 bytes, only Cc control chars stripped). Any plugin can call itself "Buzz". Bidi format characters such as U+202E are not stripped either, so they can reorder the text around the origin. Show the plugin id plus publisher or source, and strip Cf characters. (3) A "Don't Allow" is not remembered, so a plugin can re-prompt in a loop and the dialog is parented to the window. Add a per-plugin cooldown or deny-until-restart after a decline. Not a blocker.
There was a problem hiding this comment.
🤖 @joahg Thanks. I'm keeping all three out of this PR. Each one is now under Known limitations in the description:
- Another plugin's id. Agreed. Every host command takes
idandrevisionfrom its caller, so plugin A can raise the dialog under plugin B's name. On Allow, the origin is saved for B, and A can then reach it through B's id, as it already can with B's manifest origins. Binding host calls to the calling plugin would change every host command, not just this one. - The name alone. The dialog uses the manifest name, as the access review and the agent enable dialog do. Showing the id and the source would fit all three. Bidi format characters such as U+202E are listed too.
- Asking again after Don't Allow. A decline isn't remembered, so a plugin can ask again. Only one dialog can be open at a time. A cooldown after a decline would be a reasonable follow-up.
| } | ||
| /// A bare HTTPS origin: no credentials, path, query or default port, so it | ||
| /// equals what a request URL's origin serializes to. | ||
| fn valid_origin(origin: &str) -> Result<()> { |
There was a problem hiding this comment.
🤖 P2: Not fixed: valid_origin still accepts https://127.0.0.1, https://[::1], https://169.254.169.254, RFC1918 literals and localhost. The author kept them on purpose for self-hosted servers and lists it under Known limitations. The request path has no address filtering either (the only loopback/private checks are in public_image.rs). With the consent gate this is no longer a P1: the person sees the exact origin and the request has no cookies. It is still worth a stronger dialog warning, such as "this address is on your own machine or network", when the host is an IP literal, loopback, link-local or private, so a plugin cannot pass cloud-metadata or an internal admin port as an ordinary server.
There was a problem hiding this comment.
🤖 @joahg Agreed, a plainer warning for these hosts would help. I've kept it out of this PR. The dialog names the exact origin, and as you note, the request carries no cookies. Your suggestion is now under "Loopback and private hosts are allowed" in Known limitations: a note such as "This address is on your own computer or network" when the host is loopback, link-local, private or an IP literal.
|
🤖 Closing this. The plugin it was first written for no longer needs it, and no plugin we maintain calls it. Thanks @joahg for the careful review. The branch stays, so anyone who needs runtime-approved origins, such as the self-hosted case raised above, can pick it up from here. |
## TL;DR The Update and reload button can lose its click when the candidate is stale or an update check is already running. Carry that click through fresh validation to an explicit update review, or plugin settings when the candidate is no longer usable. ## What - Use one pending action for the notice and Profile → Plugins. Disable competing Update items while preserving Manage plugins. - Show Preparing update… while a check or another review holds the request. Later or Dismiss cancels it, including menu requests after Later hid the notice. - Keep the pending button keyboard-focusable and return menu reviews to the surviving Profile button. Ignore late results after cancellation or unmount. - Preserve the review lease, freshness and access checks, explicit confirmation, notification-body navigation, and signed-managed automatic-update notices. The button never installs an update by itself. ## Testing Added one browser journey and removed none. It exercises the real Settings Check again action, a held in-flight check through the native-IPC fixture, layered keyboard dismissal, one notice click, an enabled explicit review, and no install before confirmation. Those app/fixture boundaries supplement the colocated React cases; they do not establish native Tauri behavior. The complete affected file passed in Chromium and WebKit: `bin/pnpm test:browser tests/browser/plugin-import.spec.mjs --project chromium --project webkit --no-deps --workers=2` (68 cases). The captures below show the notice, a narrow dark pending state with enlarged text, and the wide light review. Human confirmation remains outstanding. ### Profile-menu regression scenario Fixture-only setup: a synthetic Git-sourced Notes plugin has an available update, and the fixture holds the update-review slot. Holding and releasing that slot are fixture operations; the menu and notice actions below use ordinary app controls. 1. Choose **Later**, then **Profile → Plugins → Update Notes** while the slot is held. Keyboard access uses ArrowDown, ArrowRight, then Enter. 2. Expect **Preparing update…**. Reopen **Profile → Plugins**: competing Update items are disabled; **Manage plugins** remains available. 3. Close the menus, choose **Later** or **Dismiss** on the notice, then release the fixture hold. No review or installation follows. 4. Retry **Profile → Plugins → Update Notes**. Exactly one explicit review opens; **Close** returns focus to Profile. Nothing installs before confirmation. This scenario does not record human or native verification. The [repository readiness checklist](https://github.com/block/buzz-app/blob/1dacf66356f9c4794bed5ec12a77b0f98efce135/AGENTS.md#before-opening-a-pr) still applies. ### Synthetic interaction captures    ## Related work - [#2963](#2963) adds runtime plugin-origin permissions; its changes do not alter this update-notice action. - [#2762](#2762) adds shared Markdown and panel workspaces; its changes do not alter this update-notice action. - [#2983](#2983) adds the controlled document editor and browser coverage in the shared import spec; this PR keeps the notification-action journey separate. - [#2621](#2621) shares plugin update discovery and results between notifications and Settings; this PR leaves that shared reconciliation path untouched. Generated with Codex (gpt-6.1-sol) on behalf of kylez. --------- Signed-off-by: Kyle Zemek <kylez@squareup.com> Co-authored-by: Codex (gpt-6.1-sol) <noreply@openai.com> Co-authored-by: Antigravity (Gemini 4 Neon) <noreply@google.com>
Summary
host.requestreaches only the origins fixed in a plugin's manifest, so a public plugin can't reach a self-hosted server whose address differs for each person, such as a Plane board.host.requestOrigin?(origin): Promise<boolean>asks Buzz to let the calling plugin reach one exacthttps://host[:port]origin. Before it saves anything, Buzz shows a native dialog that names the plugin and the origin, with Allow and Don't Allow. The call resolvestruewhen the person allows it, andfalsewhen they decline. Approved origins are kept apart from the manifest's grants: onlyhost.request, its byte reads and uploads see them. They are kept across restarts and updates from the same source and publisher, and forgotten when the plugin is removed. What this plugin can do in Settings lists them, and so does the dialog where the owner reviews an agent's request to enable the plugin. No FOUNDATION file is edited.Problem
A plugin can call
host.requestonly for origins fixed in its manifest. That rules out a public plugin for a self-hosted service, such as a Plane project board, where each person's server URL is different. Today such a plugin needs a per-user manifest edit and an install from a folder, or a server that rewrites the manifest.Change
host.requestOrigin?(origin): Promise<boolean>. The calling plugin asks to reach one more exacthttps://host[:port]origin with itsrequest, byte and upload calls.truewhen the person allows it, and at once, with no dialog, when the manifest declares the origin or the person already approved it. A plugin can call it on every start.falsewhen the person declines. Nothing is saved, and the origin stays refused.plugin_host_request_origin, checks the origin and the calling plugin, then shows a native message dialog parented to the app window: "Allow network access?", "Let “Board client” connect to https://plane.example.org:8443? The plugin can then make HTTPS requests to this address until you remove it.", Allow and Don't Allow. It saves the origin only after Allow.import()into the main web view, so plugin code shares the host's JavaScript realm and can call every command the host can. Any prompt drawn in the web view, or any token minted there, is one plugin code could draw, skip or forge itself. A dialog shown by the native command, before it saves, is one plugin code can neither draw nor skip.host_grantsreturns the manifest's grants only, as on main. A separate read,request_grants, adds the approved origins, and only the threehost.requestchecks use it: requests, byte reads and uploads. Gateway forwarding, federated identity, MCP, processes and files still read the manifest alone, so an approved origin can't enable gateway forwarding.approved_origins), not in the manifest, up to 64 per plugin.plugin_changeis as on main. The management command no longer saves origins, so it again retires the plugin's registrations around every action.docs/plugin-authoring-guide.mddocuments the call and gives a settings-card recipe for the self-hosted case: the person types their server address in the plugin's own settings, the plugin callsrequestOrigin, Buzz asks, and ontruethe plugin callsrequest.docs/plugin-architecture.mdhas the contract.Intent
The person agrees to let one named plugin reach one exact origin at runtime, in a prompt Buzz draws. That answer is remembered for that plugin, and
host.requestthen reaches the origin. An origin they decline stays blocked.host.requestto the origin is refused, and after it, allowed. Declining keeps it refused. Approval survives a restart. Another plugin isn't granted. No path that plugin code can reach saves an origin without the person's answer in the Buzz-drawn dialog.Known limitations
valid_origin,crates/plugin-manager/src/lib.rs:351), includinghttps://localhost, private and link-local addresses. Self-hosted servers on a LAN or on the same machine are the use case, and the dialog names the exact origin the person allows. This PR adds no IP filtering. A plainer warning in the dialog for these hosts, such as "This address is on your own computer or network" when the host is loopback, link-local, private or an IP literal, would help; it isn't in this PR.host.publicImagesstarts an image read from an origin it hasn't declared, then gets that origin approved before the read finishes. The completion check (src-tauri/src/host_request.rs:476on main) sees the reach change from public image to declared and fails the read with "Host request origin is not declared". Nothing is let through that shouldn't be, and a retry succeeds.plugin_host_request_origintakes the plugin id and revision from its caller, and plugin code shares the main web view. So one plugin can raise the dialog under another installed plugin's name, and on Allow the origin is saved for that other plugin. The first plugin can then reach it through the other plugin's id, as it already can with that plugin's manifest origins. It can't save an origin without the person's answer. Binding host calls to the calling plugin would change every host command, not just this one.%escape. The dialog can't be shown in tests, and the escape is one line inside the command that shows it (host_request.rs:249).typeof ctx.host.requestOrigincheck detects older desktop hosts. On the web build the method exists and rejects, so a plugin should also handle the rejection.Core change check
Each core change is measured against this project rule: a feature a plugin can build belongs in a plugin, and core adds only the smallest general capability a plugin needs to own that feature.
crates/plugin-manager/src/lib.rs(+156/−8 outside tests):approved_originsper plugin (:687), the checkorigin_request(:1674) and saveapprove_origin(:1684) sharingunreached_origin(:1693),request_grants(:1658), and the carry-over rulesame_publisher_and_location(:367) used by install (:1377), rollback (:1470) and folder reload (:1597)host_grantsreturns only the manifest'shost(crates/plugin-manager/src/lib.rs:1570-1587), and every native request path refuses other origins with "Host request origin is not declared" (src-tauri/src/host_request.rs:252,:552,:560,:656). A plugin's origins are fixed at install: a changedmanifest.hostwaits for the owner's update review. No management action adds an origin: plugin code that tries ends at "Unknown management action" (lib.rs:1423). So no plugin can reach a URL the person types.host_grants(:1637) is unchanged from main, so gateway forwarding (src-tauri/src/host_forward.rs:917-937) and every other reader ofnetwork_originssee the manifest only. One rule for carry-over, used at the three places the current source or signature changes. The 64-origin cap bounds the list that every request reads. Nothing names a plugin or a service.src-tauri/src/host_request.rs(+82/−5): theplugin_host_request_origincommand (:233) with its native dialog (:250), the check-ask-save logicrequest_origin(:271), the one-dialog lock (:227,:288), andrequest_grantsat the request (:319), byte (:612) and upload (:682) checksimport()into the main web view (src/plugins/modules.ts:26on main), so plugin code shares the host's JavaScript realm and can invoke every Tauri command the host can. A consent prompt drawn in that view, or a token minted there, is one plugin code can draw, skip or forge;HostCalls::consume(host_request.rs:80) accepts caller-chosen ids, so it guards against replay and proves nothing about consent. A plugin can't produce consent the host can trust. Only a dialog the saving command shows itself can.%(:249), because the GTK backend reads it as a printf format. The three request checks change one call each; byte reads and uploads already share the request's origin rule.src-tauri/src/lib.rs(+3/−1),src-tauri/build.rs(+1) andsrc-tauri/capabilities/default.json(+1): register the commandplugin_host_*command beside it.plugin_change(lib.rs:673) is unchanged from main.src/features/host/service.ts(+22):host.requestOrigin(:253,:707)Hosthasrequestand no call that adds an origin (src/features/host/service.ts:244). Every documented host call binds to the caller throughctx.pluginOwner, asrequestdoes (service.ts:687).src/app/PluginAccessReview.tsx(+15),src/app/PluginMenu.tsx(+2/−2) andsrc/app/AgentPluginRequests.tsx(+2/−2): approved origins in the access reviewssrc/app/PluginMenu.tsx:132) and the agent enable dialog (src/app/AgentPluginRequests.tsx:300) render only the manifest's grants, so the owner couldn't see an approved origin. A plugin can't add to the host's access review.src/plugins/types.ts(+2)PluginInfo(src/plugins/types.ts:3) mirrors the nativePluginInfo(crates/plugin-manager/src/lib.rs:903on main), which now carries the list.crates/plugin-manager/src/managed.rs(+1)src-tauri/src/host_request/origin_tests.rs,replay_tests.rs,host_forward/tests.rs, the tests incrates/plugin-manager/src/lib.rs,service.test.ts,PluginUpdates.test.tsx,AgentPluginRequests.test.tsx,author.test.mjs,docs/plugin-architecture.md,docs/plugin-authoring-guide.mdLine numbers are at the head unless marked "on main". Names: a grep of the core diff for every
src/bundleddirectory name finds two plugin IDs, both test fixtures.buzz.remindersin thelib.rstests checks that a bundled plugin can't request an origin, andbuzz.channelsinservice.test.tschecks the same in the host service. No FOUNDATION file is changed.Merge order
Independent: this PR depends on no other open PR, and no open PR depends on it. It can merge in any order.
Validation
The head
f04fa100fis one commit on maine9f6f53ff. It squashes four commits: the earlier headefa7dde12rebased with no conflicts as4dc4754ee, then this round's6d8adf001and782d88fff, and a last fix that removes control characters from the plugin name before the dialog is built. That fix changes one line insrc-tauri/src/host_request.rsand the route test's fixture.Run on a separate Linux machine at
f04fa100f:cargo fmt --all --check: pass.cargo test --libinsrc-tauri, filtered:host_request59 passed,host_forward18 passed,federated_identity::access6 passed andbrowser_permissions1 passed. None failed.left: "Origins\0 fixture",right: "Origins fixture".scripts/check-push.mjs,--design,--clippy): all three pass. The types lane rantscand 2,422 related tests in 61 files, none failed (12 skipped). The Clippy lane found nothing.The landmines Oxlint rules, on the lines this PR adds against
e9f6f53ff, report twono-test-doublesfindings,src/features/host/service.test.ts:1857(vi.mocked(invoke).mockResolvedValue) and:1881(vi.mocked(isTauri).mockReturnValue), which stay because they follow that file's own way of standing in for the Tauri bridge in unit tests (main's copy sets return values on the mockedinvokeorisTauri94 times).Run at
782d88fff, the tree before that last fix:cargo test -p buzzodz-plugins: 203 passed, none failed.cargo test --libinsrc-tauri, filtered:host_request59 passed,host_forward18 passed,federated_identity::access6 passed andbrowser_permissions1 passed (it checks the command ACL). None failed.pnpm exec tsc --noEmit,pnpm exec biome check --error-on-warnings .andpnpm run design:check: pass.pnpm exec vitest runon the host-service, access-review, agent-request, plugin-update, managed-plugin and author-package suites: 215 passed in 6 files, none failed.pnpm exec vitest run: 23,616 tests passed in 1,163 files, none failed (31 tests and 9 files skipped).scripts/check-push.mjs,--design,--clippy) at this SHA: all three pass. The types lane rantscand 2,422 related tests in 61 files, none failed (12 skipped). The Clippy lane found nothing.6d8adf001, before the review fixes.The gateway test fails on the earlier head. On
efa7dde12, with the same test approving the origin through that head'sallow-originaction, it fails withleft: Ok(()),right: Err("The agent gateway is not declared"): the approved origin let the plugin forward.What the tests cover:
src-tauri/src/host_request/replay_tests.rs):plugin_host_requestto a loopback origin fails with "Host request origin is not declared". The check-ask-save route with a declining answer returnsfalse, and the same request is still refused. With an allowing answer it returnstrue, and the request passes the origin check: it reaches the listener and fails at its untrusted TLS ("Host request failed"). The native dialog itself is replaced by the answer; the mock app has no dialog.src-tauri/src/host_request/origin_tests.rs): an origin already declared or approved returnstrueand never asks, and the dialog gets the plugin's name without control characters (the fixture's name contains a NUL). A malformed, wildcard orhttporigin errors before asking. A plugin disabled or updated while the dialog is open saves nothing. A second request while one is open rejects, and the next one after it can ask.src-tauri/src/host_forward/tests.rs): an external plugin with an approved gateway origin failsgranted()with "The agent gateway is not declared".crates/plugin-manager/src/lib.rs):http, a path, a trailing slash, a query, credentials, the default port, a wildcard,ftp, a missing scheme and an empty string. The 65th origin is refused, and so is a bundled plugin.src/features/host/service.test.ts):requestOrigincallsplugin_host_request_originwith the calling plugin's id, running revision and the origin, and returns the nativetrueorfalse. A bundled plugin, a context with no plugin and the browser are refused without a native call. These tests set return values on the mockedinvokeandisTauri, as the file already does in many other places.src/app/PluginUpdates.test.tsx) and agent enable request (src/app/AgentPluginRequests.test.tsx): the access reviews list an approved origin.Removed: the tests for
allow-originthroughplugin_changeand for the predicate that kept registrations for it, which no longer exist.End-user test (AGENTS.md step 3)
An end-user test by the maintainer's agent on a separate Linux machine. It used the real desktop app (a debug build from
pnpm tauri build --debug --no-bundle) under Xvfb with the openbox window manager, driven by a WebDriver script, against a real local relay. Buzz's consent prompt is a native GTK dialog, outside the web view, so the script found it in the window manager's client list (_NET_CLIENT_LIST) and clicked its buttons withxdotool. Each step is scripted and has a screenshot; the step 11 screenshot is a full-display capture with the dialog open.f04fa100faa31f3a7eae1ad459ff8e34e768f856. The control is the merge base on main,e9f6f53ff4e082bf145ea0dc54efd4112f4cd7ae. Main did not change, so the control run is reused from the earlier run of this test at head69cf37bed546e93c4c010d2941735f276780e990; steps 1 to 10 were run again on the new head, and step 11 is new.a26eacde491b39c3ebc0084622d66d2df2b10803, behind a local TLS proxy atwss://localhostthat uses a throwaway CA. The app used a new throwaway identity and joined thelocalhostcommunity.https://localhost:8443. Its certificate comes from the same throwaway CA, which is in the system trust store.GET /api/mereturns{"user":"tester","server":"board-test"}. Its access log shows which requests reached it.networkOrigins, and all three injecthost,reactandsettingsCards. Each was installed the way a person installs one: Settings → Manage plugins → Add → Browse, pick the folder in the folder chooser, review the access shown, then Install plugin.docs/plugin-authoring-guide.md, unchanged apart from its title. It also has a test section with its own URL field and three buttons. "Test request" callshost.requestfor<origin>/api/me. "Ask as typed" callsrequestOriginwith the raw text. "Ask twice" makes tworequestOrigincalls at once.requestOrigin.manifest.json.On head:
Error: Host request origin is not declared. The server got no request.https://localhost:8443typed, Connect opened one new window: Buzz's native dialog, titled "Allow network access?", saying "Let “Board client” connect to https://localhost:8443? The plugin can then make HTTPS requests to this address until you remove it.", with the buttons Allow and Don't Allow. After a click on Don't Allow, the dialog closed and the card showed the recipe's "Not connected: Buzz was not allowed to reach it." (sorequestOriginresolvedfalse). "Test request" still failed withHost request origin is not declared, the server got no request, and the access review still showed "No additional capabilities declared".Buzz/1.0.1). "Test request" then returned status 200 with the JSON body.https://localhost:8443resolvedtrue, and no new window appeared in the 3 s the script watched the window list.Error: Host request origin is not declared. The server got no request.Host request origin is not declared. The access review still listed the origin.requestOrigin("https://board.example.org/path"),("http://localhost:8443")and("https://localhost:443")rejected withInvalid HTTPS origin: use https://host[:port], with no path.requestOrigin("https://*.example.org")rejected withWildcard origins cannot be approved. No dialog appeared for any of them.https://board.example.org, opened exactly one dialog. After Don't Allow, one call resolvedfalseand the other had rejected withAnother network access request is open. The access review still listed onlyhttps://localhost:8443.https://localhost:8444typed (nothing serves that address), Connect opened one native dialog, titled "Allow network access?", reading "Let “Null client” connect to https://localhost:8444? The plugin can then make HTTPS requests to this address until you remove it." The app's process was the same before, during and after, and the web view still answered. After a click on Don't Allow, the dialog closed, the card showed "Not connected: Buzz was not allowed to reach it." (requestOriginresolvedfalse), and the access review for Null client showed "No additional capabilities declared", with no origin listed. This run didn't try the name on the earlier head. There, the dialog library's Linux backend builds the message withCString::new(…).unwrap(), which panics on a NUL.In the whole head run, the target server logged three requests from the app (none for
localhost:8444), and all of them came from Board client after Allow: one at Connect, one from "Test request" after it, and one after the restart. No refused request reached the server.On main (control): Board client installed the same way. Its card showed the recipe's "Update Buzz to connect your server." branch, because
requestOriginis absent there ("Ask as typed" reportedrequestOrigin is absent, and no dialog appeared). "Test request" failed withError: Host request origin is not declared, and the server got no request. The access review showed "No additional capabilities declared".The dialog was clicked on Linux only. On macOS and Windows, the mapping from button to result was read in the dialog libraries' source (tauri-plugin-dialog 2.8.3 and rfd 0.16.0): Allow resolves
true, and Don't Allow, closing the dialog or Escape resolvefalse.Try it
networkOrigins, callawait ctx.host.request({ url: "https://httpbin.org/get" }). Expected: it throws "Host request origin is not declared".await ctx.host.requestOrigin("https://httpbin.org"). Expected: Buzz shows "Allow network access?", naming the plugin andhttps://httpbin.org.false, and the request in step 1 still throws.true, the request succeeds, and Settings → Plugins → Manage plugins → the plugin row's "More actions" menu → "Review access" listshttps://httpbin.org. A third call resolvestruewith no dialog.requestto the same URL is refused.🤖 Generated with Claude Code