Repository navigation
fix(browser): ask for consent before executing a discovered site tool - #4734
Conversation
…wser-agent (temporary)" This reverts commit cfb7b7b.
…ange relay The preload relays registerTool activity to the host after a 250 ms debounce, so the notification routinely lands after webmcp_list_tools already returned those same tools. Treating it like a navigation bumped the tab revision and deleted every handle, so the next webmcp_call_tool failed as stale_tool before confirmExecution and the person never saw the Allow once prompt. Only navigation replaces the document now. Execution still revalidates the live descriptor digest, so changed or removed tools remain stale_tool.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Warden review summary — ClearNative findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (55042 ms), confidentiality-review (12158 ms), desktop-den-sync-review (20506 ms). Blockers
Advisories
Needs recheck
Observed review-thread metrics
Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority. |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (66e8bdb59f8f5e11e61cd581165edc0f0256231f). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
|
Passed · 3/3 tests · 4/4 assertions · 2 images Commit |
Fixes the
webmcp-browser-agentred in the Daytona E2E lane (triage:reports/e2e-red-2026-09-09/triage.md, Cluster 6 / Brief I — "Site-tool consent skipped on Daytona").Root cause
ipcMain.on("openwork:webmcp:tools-changed")inbrowser-panel.mjscalledinvalidateWebMcpTab(tab), which bumpswebMcpRevisionand deletes every WebMCP tool handle for the tab. That IPC is the preload's relay of the page'sregisterToolactivity, debounced by 250 ms, so on a freshly navigated page it lands ~250 ms after the document script ran — routinely afterwebmcp_list_toolsalready returned those same tools.Sequence in the red nightlies (trace
…21-24-36-286Z…/test-run.jsonseq 149–152):navigate /execution-delay→site_toolslists 5 tools (237 ms) → relay lands →site_toolreturns in 223 ms. The broker'sexecuteToolfound no handle and threwstale_toolbeforeconfirmExecution, so no "Allow once" prompt ever mounted and the spec timed out 30 s later. Whether the relay lands beforesite_toolsor betweensite_toolsandsite_toolis pure timing — deterministic under the loaded nightly lane, green in a quiet single-spec run (my first Daytona run of the unchanged product atcfb7b7bcpassed, which is why this is a race, not a policy).Ruled out from the brief:
94649b44a) / team browser policy (012586824): those only add deny paths (checkPolicy); nothing auto-allows. Steps 5–8 of the same red runs show "Allow once" working on the same page.confirmBrowserAction), independent of the engine. The red runs wereengine: v1.What changed
apps/desktop/electron/browser-panel.mjs: thetools-changedrelay no longer treats a registration change like a navigation. It only schedules the tool-count refresh. Onlydid-start-navigationbumps the revision. Safety is unchanged:executeToolstill re-reads the frame's live tools and compares the descriptor digest before consent, and the in-page dispatcher checks the digest again, so a changed or removed tool is still refused asstale_tool(existing broker test "navigation and descriptor changes invalidate opaque handles" covers this without any revision bump).apps/desktop/electron/browser-panel.test.mjs: the stubwebContentsgains an origin-keyedmainFrameso the harness can drivesite_tools/site_tool. New test: list a tool, emitopenwork:webmcp:tools-changedfrom the tab, thensite_toolmust mount "Allow website action?" before anything runs; approve execution and result sharing; then a removed tool is stillstale_tool. Red on the previous handler (browserApprovalundefined), green with the fix.No spec changes. The journey's claim ("execution approval is asked after navigate + list") is unchanged; it is now independent of relay timing.
Proof
{"placement":"daytona","engine":"legacy","surface":"legacy","files":["webmcp-browser-agent"],"passed":1,"failed":0,"skipped":0,"verdict":"passed"}— sandbox checked out66e8bdb5; all 17 steps ok; both sandboxes disposed.Unit:
node --test apps/desktop/electron/browser-panel.test.mjs apps/desktop/electron/webmcp-host.test.mjs apps/desktop/electron/webmcp-policy.test.mjs→ 85 passed, 0 failed.Caveat on the journey as proof of this race: it exercises the "relay between list and execute" ordering only when timing produces it (as the nightly lane did). The panel test pins that ordering deterministically.
Noticed, not touched
refreshTabToolCount→onToolsChangedreplacestab.webMcpToolswith entries lackingtoolId(unlikelistTools), so the panel'ssiteToolspayload shape depends on which path ran last.agent.run("browser.open_url")with "no interactive surface" (composer off-screen in the default local window). Not investigated; Daytona is the proof lane.cfb7b7bc+ its revertd1ec0c67) are left in the branch history as the record of the quiet-lane pass on unchanged product; the net diff is only the two files above.