Repository navigation
feat(dashboard): let widgets run granted actions and open links - #127315
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
829d66c to
0e0a46c
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 4:33 PM ET / 20:33 UTC. ClawSweeper reviewWhat this changesThe PR lets dashboard widgets invoke explicitly granted plugin actions, receive the Control UI base URL, and open user-clicked links in a new tab. Merge readinessKeep this maintainer-authored PR open: the action bridge preserves Gateway-side ticket, grant, and parameter validation, but its sandbox relaxation touches a restricted security-owned path and needs listed-owner confirmation before merge. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherDashboard widgets run inside nested sandboxed frames and use a private ticket-bound bridge to reach the Gateway. The bridge forwards approved action requests while frame sandbox attributes control whether user navigation can leave the embedded widget. flowchart LR
Widget[Dashboard widget] --> Bridge[Private widget bridge]
Bridge --> Ticket[View ticket]
Ticket --> Grants[Gateway grant checks]
Grants --> Action[Plugin action]
Widget --> Link[User-clicked link]
Link --> Sandbox[Composed sandbox policy]
Sandbox --> Tab[New browser tab]
Decision needed
Why: The author recorded the product decision, but CODEOWNERS marks the changed shared sandbox host as a restricted security path and the supplied review context does not identify listed-owner involvement. Before merge
Findings
Agent review detailsSecurityNeeds attention: The action path preserves Gateway authorization, but the popup escape changes a restricted shared sandbox path without evidenced listed-owner review. PR surfaceSource +36, Tests +36, Docs +7. Total +79 across 14 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the ticket-bound action bridge and popup behavior, then land after the restricted-path owner confirms the user-activated sandbox escape policy. Do we have a high-confidence way to reproduce the issue? Not applicable; this is a new dashboard capability rather than a report of broken established behavior. Is this the best way to solve the issue? Yes, subject to restricted-path approval: routing through the existing ticket-bound board action API preserves the established grant and plugin ownership checks, unlike direct Gateway access. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3ea90bdcdb30. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
Addressed the completed review feedback in
Validation: 73 focused tests passed, |
864bf02 to
6b30800
Compare
|
Maintainer policy decision for current head The implementation and coverage were simplified in
ClawSweeper's reported live-verification failure is a harness Validation on the current repair: 112 focused tests passed, |
|
Maintainer evidence decision for This is an intentional acceptance of the remaining evidence gap, not a request for another code path. ClawSweeper's current review reports no action-bridge defect, The earlier ClawSweeper live-verification output also shows @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer runtime verification for exact head This directly verifies the rendered-widget popup composition in the real application. A screenshot is not attached because the tested dashboard contains private operational data. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
… popups (#128125) * fix(dashboard): open widget links through the host instead of sandbox popups Widget frames granted allow-popups/allow-popups-to-escape-sandbox to every rendered widget, including grantState "none" widgets that never reach an operator approval card. CSP has no navigate-to, so a popup bypassed the connect-src 'none' containment those widgets otherwise run under. Scripted window.open was blocked only by the document guard's open lock, which is emitted solely when blockDescendantFrames is set, so two unrelated knobs had to agree for the boundary to hold. Restore both sandbox strings and route user-clicked links through the existing ticket-bound bridge: a trusted click on a ticketed board widget's http(s) target="_blank" anchor forwards to the Control UI, which opens the tab with noopener,noreferrer. Links keep working for every rendered widget, the host owns the scheme filter instead of trusting widget-authored rel attributes, and scripted popups are impossible by construction rather than by coincidence. Also collapses the unreachable controlUiBaseUrl branch and corrects both docs pages, including the claim that links opened for every rendered widget, which was never true for MCP-App board widgets. Follow-up to #127315; refs #127314. * fix(dashboard): open widget links through the Control UI external-url owner The widget bridge opened links with a local window.open helper, which the lint:ui:no-raw-window-open boundary guard rejects. Delegate to openExternalUrlSafe(), the Control UI owner for external navigation: it applies noopener/noreferrer, detaches the opener handle, and keeps one canonical open path. The bridge keeps a narrower absolute-http(s) gate, since widget-supplied links must not reach blob: URLs that the shared external-link policy permits. * fix(dashboard): route middle-button widget links and honor canceled clicks Address ClawSweeper review on #128125. The wrapper only handled primary click, so with popup permission removed from both sandbox layers a middle-button activation silently did nothing. It also listened on capture, so a widget handler's preventDefault could not cancel the link the wrapper then opened itself. Match the Control UI activation contract in ui/src/app/native-link-routing.ts: listen for click and auxclick, gate on !defaultPrevented && !shiftKey && !altKey && (click+button 0 || auxclick+button 1), and listen on bubble so widget cancellation stays effective. A middle click now routes for any widget link, not just target=_blank, since middle-click always means new tab and leaving plain links unrouted would keep the same silent-no-op class. Move the wrapped-document test into src/canvas/wrap.test.ts: it exercises buildWidgetDocument, so it belongs with its owner, and the added assertions would otherwise push widget-tool.test.ts past the max-lines cap that AGENTS.md forbids suppressing.
… popups (openclaw#128125) * fix(dashboard): open widget links through the host instead of sandbox popups Widget frames granted allow-popups/allow-popups-to-escape-sandbox to every rendered widget, including grantState "none" widgets that never reach an operator approval card. CSP has no navigate-to, so a popup bypassed the connect-src 'none' containment those widgets otherwise run under. Scripted window.open was blocked only by the document guard's open lock, which is emitted solely when blockDescendantFrames is set, so two unrelated knobs had to agree for the boundary to hold. Restore both sandbox strings and route user-clicked links through the existing ticket-bound bridge: a trusted click on a ticketed board widget's http(s) target="_blank" anchor forwards to the Control UI, which opens the tab with noopener,noreferrer. Links keep working for every rendered widget, the host owns the scheme filter instead of trusting widget-authored rel attributes, and scripted popups are impossible by construction rather than by coincidence. Also collapses the unreachable controlUiBaseUrl branch and corrects both docs pages, including the claim that links opened for every rendered widget, which was never true for MCP-App board widgets. Follow-up to openclaw#127315; refs openclaw#127314. * fix(dashboard): open widget links through the Control UI external-url owner The widget bridge opened links with a local window.open helper, which the lint:ui:no-raw-window-open boundary guard rejects. Delegate to openExternalUrlSafe(), the Control UI owner for external navigation: it applies noopener/noreferrer, detaches the opener handle, and keeps one canonical open path. The bridge keeps a narrower absolute-http(s) gate, since widget-supplied links must not reach blob: URLs that the shared external-link policy permits. * fix(dashboard): route middle-button widget links and honor canceled clicks Address ClawSweeper review on openclaw#128125. The wrapper only handled primary click, so with popup permission removed from both sandbox layers a middle-button activation silently did nothing. It also listened on capture, so a widget handler's preventDefault could not cancel the link the wrapper then opened itself. Match the Control UI activation contract in ui/src/app/native-link-routing.ts: listen for click and auxclick, gate on !defaultPrevented && !shiftKey && !altKey && (click+button 0 || auxclick+button 1), and listen on bubble so widget cancellation stays effective. A middle click now routes for any widget link, not just target=_blank, since middle-click always means new tab and leaving plain links unrouted would keep the same silent-no-op class. Move the wrapped-document test into src/canvas/wrap.test.ts: it exercises buildWidgetDocument, so it belongs with its owner, and the added assertions would otherwise push widget-tool.test.ts past the max-lines cap that AGENTS.md forbids suppressing.
Closes #127314
What Problem This Solves
Dashboard widgets could read granted data and trigger cron jobs, but they could not invoke plugin-owned dashboard actions through the existing ticket-bound bridge. Rendered widget links also could not open normally in a new tab because popup permissions were missing across the composed outer and nested sandboxes, and widget code did not know the host Control UI base URL.
Why This Change Was Made
This adds
openclaw.action.run(actionId, params?)on the widget host API and routes it through the existing ticket-boundboard.actionmethod. The host also supplies a canonicalopenclaw.host.controlUiBaseUrl.User-clicked links are ordinary widget navigation rather than a granted capability. Popup composition is enabled for rendered
noneandgrantedHTML/plugin widget frames, while pending and rejected widgets retain their approval placeholders and stricter sandbox. Data, network, prompt, cron, and plugin-action authority remain governed by their existing ticket and grant checks.User Impact
Dashboard widgets can provide working links to Control UI sessions or external records without navigating away from the dashboard. Plugin dashboards can also invoke their explicitly granted action verbs without direct Gateway calls or sandbox-origin inference.
Evidence
src/canvas/widget-tool.test.ts,src/gateway/mcp-app-sandbox-http.test.ts,ui/src/components/board/board-view.test.ts,ui/src/components/board/board-widget-frame.test.ts,ui/src/lib/board/widget-bridge.test.ts, andui/src/lib/board/widget-sandbox-host.test.ts.pnpm check:changedpassed all runnable lanes, including formatting, lint, dead-code, i18n, import-cycle, dependency, and policy guards. This sparse worktree caused the repository guard to skip full core/UI typecheck shards whose tracked inputs are absent.pnpm ui:buildpassed, including the production Control UI build and sidecar checks.pnpm docs:list --headingspassed and includestools/show-widget.mdandweb/dashboard-architecture.md.This PR was prepared with AI assistance. I reviewed the implementation and validation results.