Skip to content

fix(dashboard): open widget links through the host instead of sandbox popups - #128125

Merged
steipete merged 3 commits into
mainfrom
steipete/pr-127315-review-test-da8fd6
Aug 23, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/pr-127315-review-test-da8fd6

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Follow-up to #127315; refs #127314.

What Problem This Solves

Resolves a problem where any pinned dashboard widget — including one that declares no capabilities and therefore never shows an operator approval card — could open an arbitrary external site in a new, fully unsandboxed tab as soon as the operator clicked anything the widget rendered.

#127315 shipped widget links by adding allow-popups allow-popups-to-escape-sandbox to the widget iframe sandbox. Those flags were applied to every rendered frame, not only to widgets whose capability grant is active. Widgets in grantState: "none" are otherwise fully network-contained by connect-src 'none', img-src data:, form-action 'none', and frame-src 'none' (src/gateway/board-sandbox.ts). CSP has no navigate-to directive, so a popup bypasses all of it, and widget HTML is model-authored.

The second problem was structural. The only thing preventing a widget from calling window.open(...) from script was lock(globalThis,"open",undefined) inside buildSandboxDocumentGuardHtml, which is emitted only when blockDescendantFrames is true (src/agents/sandbox-host.ts:22). board-sandbox.ts is its sole caller. Two unrelated knobs — one about embedded frames, one about popups — had to agree for the boundary to hold, with nothing documenting or testing the coupling.

#127314 proposed granting popups only after a capability grant is active. The merged implementation was broader than that.

Why This Change Was Made

Both sandbox strings are restored to their pre-#127315 values, and user-clicked links now travel through the existing ticket-bound bridge instead of through a sandbox permission. The widget wrapper installs a capture-phase click listener that forwards a trusted click on a ticketed board widget's http/https target="_blank" anchor to the Control UI, which performs the window.open and applies noopener,noreferrer itself.

This removes the escalation rather than narrowing it: scripted popups are now impossible by construction rather than by coincidence, noopener no longer depends on the widget author writing rel correctly, and the host owns the scheme filter. It also decouples popup behaviour from blockDescendantFrames entirely, so relaxing that unrelated flag can no longer hand widgets a popup channel.

Non-goal: this does not change the shipped product decision that a user-clicked link is ordinary navigation. An operator who clicks a widget's link still reaches that destination. What changes is that the destination now passes through one trusted, testable place, which is where any future policy would go.

Also collapses the unreachable controlUiBaseUrl branch (the only production caller always passes a non-empty string) and corrects both docs pages, including the claim that links open "for every rendered widget" — never true for MCP-App board widgets, which render through mcp-app-view.ts and never had popup flags.

User Impact

Dashboard widget links keep working exactly as they do today, for granted and ungranted widgets alike. Operators get a materially smaller blast radius: a widget that was never approved can no longer be handed an unsandboxed browsing context, and no widget can open a tab without a real click. Widget authors no longer need to remember rel="noopener noreferrer" — the host applies it regardless. There is no visual change and no configuration change.

Evidence

Live: isolated Gateway (own OPENCLAW_STATE_DIR, ephemeral port, gateway.controlUi.basePath=/openclaw), two widgets pinned via board.widget.put — one granted, one with no declared capabilities — driven in real Chromium against the real Control UI dashboard.

Check Result
Outer frame sandbox (both widgets) allow-scripts allow-same-origin allow-forms — no popups
target="_blank" with rel opened https://example.com/live-proof
target="_blank" without rel opened https://example.com/norel, window.opener false
javascript: link not opened; __jsRan false
data: link not opened
Scripted window.open TypeError: window.open is not a function
Synthetic .click() nothing opened (isTrusted gate)
Ungranted widget's link still opens — product behaviour preserved
openclaw.host.controlUiBaseUrl http://127.0.0.1:51750/openclaw
Ungranted action verb still refused by the Gateway grant check

Chromium's own console confirms the sandbox is closed again while http/https links keep working:

Blocked opening 'data:text/html,<b>x</b>' in a new window because the request
was made in a sandboxed frame whose 'allow-popups' permission is not set.

A separate two-origin Playwright probe confirmed the load-bearing assumption before implementation: a click inside a popup-less cross-origin iframe still grants the top window transient activation (hostActivationActive=true), so the host's window.open is not popup-blocked.

Regression coverage: 12 new/updated assertions. All fail on pre-fix code for the intended reasons (verified by reverting only the production files) and pass after — 7 UI (host.open scheme handling, blocked-popup reporting, ungranted-frame sandbox), 4 gateway (proxy popup flags, and the decoupling test asserting the inner sandbox grants no popups regardless of blockDescendantFrames), 1 canvas (widget document bytes).

Suites: core widget/sandbox 45 passed; UI board suites 203 passed / 15 skipped; node scripts/check-changed.mjs green across core, coreTests, ui, docs; pnpm build clean.

Review: Codex autoreview on the branch — clean, no accepted or actionable findings, patch is correct (0.99).

LOC: production +47/-14, tests +68/-11, docs +7/-5. 13 of the production additions are the two invariant comments the repo's comment doctrine requires at the sandbox and host.open sites.

UI proof: the dashboard is visually unchanged by design — the screenshot below shows both widgets (granted, and "no declared capabilities") rendering normally with working links after the change. The meaningful evidence is the behavioural matrix above.

… 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.
@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime docker Docker and sandbox tooling agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Aug 23, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 23, 2026, 4:16 AM ET / 08:16 UTC.

ClawSweeper review

What this changes

The PR removes widget iframe popup permissions and routes trusted HTTP(S) new-tab links through the Control UI host.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Needs changes before merge: the new host routing drops middle-button navigation and overrides widget handlers that cancel a link click.

Priority: P2
Reviewed head: e833da705336fb3e0871141c787b8e9664ec1a65

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The security direction and supplied live evidence are strong, but two ordinary link-navigation regressions remain in the proposed interception path.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies a relevant real Chromium behavior matrix.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies a relevant real Chromium behavior matrix.
Evidence reviewed 5 items Primary-only interception: The wrapper registers only a click listener and immediately rejects any non-primary button, so it never routes a middle-button activation.
Popup-free sandbox makes the regression visible: Both the outer widget iframe and inner proxy iframe now omit popup permissions, so an un-intercepted target=_blank middle click cannot use its former native popup path.
Sibling navigation contract: Control UI native-link routing explicitly treats auxclick with button 1 as a supported activation, and its regression test covers middle-click routing.
Findings 2 actionable findings [P2] Route middle-button widget links
[P2] Honor widget-canceled link clicks
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128125-EK7usj/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 103.89 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.2s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4348ms (slowest: built plugin control-plane loads 3598ms)

OpenClaw 2026.8.1 (e833da7) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Dashboard widget HTML runs inside nested sandboxes and uses a ticket-bound bridge to ask the Control UI to perform allowed host actions. This change moves external-link navigation from iframe popup permissions to the Control UI’s safe external-navigation owner.

flowchart LR
  A[Widget HTML] --> B[Injected widget wrapper]
  B --> C[Ticket-bound bridge]
  C --> D[Control UI controller]
  D --> E[Safe external navigation]
  E --> F[New browser tab]
  G[Sandbox policy] --> B
Loading

Before merge

  • Route middle-button widget links (P2) - Middle-button link activation arrives as auxclick with button === 1, but this wrapper only handles primary click. Since this PR removes popup permission from both sandbox layers, a target="_blank" widget link opened with the middle button is no longer forwarded or allowed natively, so it silently fails. Route trusted auxiliary activation through the same gates and add regression coverage.
  • Honor widget-canceled link clicks (P2) - This capture-phase listener runs before the anchor's target or bubbling handlers can call preventDefault, then opens the URL itself. A widget that intentionally cancels a target=_blank link therefore still opens an external tab, unlike ordinary navigation. Decide after widget handlers (while user activation is live) so cancellation remains effective.
  • Resolve merge risk (P1) - Merging before both activation paths are preserved would make an existing target=_blank interaction silently do nothing for middle-click users.
  • Resolve merge risk (P1) - The PR adds a net +33 production lines to replace popup authority with a ticket-bound host path; that boundary is justified, but its navigation semantics must be complete before merge.

Findings

  • [P2] Route middle-button widget links — src/canvas/wrap.ts:155-158
  • [P2] Honor widget-canceled link clicks — src/canvas/wrap.ts:155-158
Agent review details

Security

None.

PR surface

Source +30, Tests +57, Docs +2. Total +89 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 5 44 14 +30
Tests 5 68 11 +57
Docs 2 7 5 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 119 30 +89

Review metrics

Metric Value Why it matters
Production versus test delta production +47/-14; tests +68/-11; docs +7/-5 The added bridge boundary is justified by removing iframe popup authority, but its positive production growth must preserve established navigation behavior.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #127315
Summary: This PR is a follow-up candidate that replaces the popup mechanism introduced by the merged dashboard-widget-links change.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete supported link activation (recommended)
    Route trusted target=_blank auxclick/button-1 activations through the same ticket and scheme gates, and preserve preventDefault from widget handlers before merging.
  2. Accept primary-click-only links
    Intentionally retain the compatibility regression and document that dashboard widget links no longer support middle-button activation.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Route trusted target=_blank auxclick/button-1 widget links through the existing host.open path, preserve cancellation by widget handlers, and add focused regression coverage for both behaviors.

Technical review

Best possible solution:

Keep the host-owned HTTP(S) navigation design, but route trusted auxiliary activation and let ordinary widget cancellation suppress navigation before opening a tab.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: a middle click produces auxclick/button 1 while the wrapper handles only primary click, and both sandbox layers now deny the native popup fallback.

Is this the best way to solve the issue?

No: the host-owned opener is the right boundary, but the current capture-phase primary-click-only hook is narrower than the existing navigation contract.

Full review comments:

  • [P2] Route middle-button widget links — src/canvas/wrap.ts:155-158
    Middle-button link activation arrives as auxclick with button === 1, but this wrapper only handles primary click. Since this PR removes popup permission from both sandbox layers, a target="_blank" widget link opened with the middle button is no longer forwarded or allowed natively, so it silently fails. Route trusted auxiliary activation through the same gates and add regression coverage.
    Confidence: 0.99
  • [P2] Honor widget-canceled link clicks — src/canvas/wrap.ts:155-158
    This capture-phase listener runs before the anchor's target or bubbling handlers can call preventDefault, then opens the URL itself. A widget that intentionally cancels a target=_blank link therefore still opens an external tab, unlike ordinary navigation. Decide after widget handlers (while user activation is live) so cancellation remains effective.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 79e675521f7c.

Labels

Label justifications:

  • P2: The patch creates a bounded but user-visible regression in dashboard widget link activation.
  • merge-risk: 🚨 compatibility: Removing native popup handling changes established target=_blank behavior unless all supported user activation paths are retained.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies a relevant real Chromium behavior matrix.

Evidence

Acceptance criteria:

  • [P1] pnpm test src/canvas/widget-tool.test.ts.
  • [P1] pnpm test ui/src/lib/board/widget-bridge.test.ts.
  • [P1] pnpm test ui/src/app/browser-link-routing.test.ts.
  • [P1] node scripts/check-changed.mjs -- src/canvas/wrap.ts src/canvas/widget-tool.test.ts ui/src/lib/board/widget-bridge.test.ts.

What I checked:

Likely related people:

  • hannesrudolph: Commit 5b67b61 introduced the popup-based widget-link path that this follow-up replaces. (role: introduced the merged widget-link behavior; confidence: high; commits: 5b67b61964b9; files: ui/src/components/board/board-widget-frame.ts, src/agents/sandbox-host.ts)
  • steipete: The current head attributes the bridge activation filter to this contributor and the PR changes the host-navigation path. (role: recent area contributor; confidence: high; commits: e833da705336; files: src/canvas/wrap.ts, ui/src/lib/board/widget-bridge.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Route trusted auxiliary/middle-button activations through host.open with the existing ticket and HTTP(S) gates.
  • Move or restructure interception so a widget handler's preventDefault remains effective, then add focused regression coverage.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-23T05:56:04.563Z sha bda32f7 :: found issues before merge. :: [P2] Handle middle-button widget links
  • reviewed 2026-08-23T06:02:56.704Z sha bda32f7 :: needs changes before merge. :: [P2] Route middle-button widget links
  • reviewed 2026-08-23T06:18:56.292Z sha bda32f7 :: needs changes before merge. :: [P2] Handle middle-button widget links

@steipete

Copy link
Copy Markdown
Contributor Author

Live dashboard after the change

Both widgets rendering in the real Control UI on an isolated dev gateway: the granted widget (all four link variants) and one with no declared capabilities that never saw an approval card. Appearance is unchanged by design — links still render and still work; what changed is that the http/https ones are opened by the host rather than by a sandbox popup permission, and the javascript:/data: ones no longer open at all.

dashboard-widget-links

@steipete
steipete marked this pull request as ready for review August 23, 2026 06:13
@steipete
steipete requested a review from a team as a code owner August 23, 2026 06:13
… 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.
…licks

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.
@steipete

Copy link
Copy Markdown
Contributor Author

Both findings were real and are fixed in dc6b97309ee. Thanks — the middle-button one was a genuine gap, and the sibling contract you pointed at was the right reference.

[P2] Route middle-button widget links — fixed. The wrapper now listens for click and auxclick and gates on the same predicate as ui/src/app/native-link-routing.ts:126: !defaultPrevented && !shiftKey && !altKey && ((click && button===0) || (auxclick && button===1)). I widened it slightly beyond the report: a middle click is routed 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 alive. Primary clicks still only route for target="_blank", so ordinary in-frame navigation is untouched.

[P2] Honor widget-canceled link clicks — fixed. The listeners moved from capture to bubble, so a widget handler's preventDefault (or stopPropagation) is now effective and the defaultPrevented check actually sees it. This costs nothing on the security side: interception is a convenience, not the boundary — the boundary is that neither sandbox layer grants popups, so a widget suppressing its own link simply means no tab opens.

Both merge risks are therefore resolved: every supported activation path is preserved, and the navigation semantics now match the Control UI contract rather than being narrower than it.

Rank-up moves — both applied, not skipped.

Live re-verification

Activation Result
Primary click, target="_blank" + rel opened https://example.com/live-proof
Primary click, target="_blank" no rel opened https://example.com/norel
Middle click, plain link (no target) opened https://example.com/plain — was silently nothing before
Widget handler calls preventDefault nothing opened — was opening a tab before
javascript: link nothing opened; __jsRan false
data: link nothing opened
Scripted window.open TypeError: window.open is not a function
Synthetic .click() nothing opened
Outer frame sandbox (both widgets) allow-scripts allow-same-origin allow-forms
Ungranted widget's link still opens

Also in this push

Adding the assertions pushed src/canvas/widget-tool.test.ts past the 1000-line max-lines cap. Suppressions are forbidden by AGENTS.md, so instead of suppressing I moved the wrapper-document test into a new src/canvas/wrap.test.ts — it exercises buildWidgetDocument, so it belonged with its owner rather than with the show_widget tool tests. widget-tool.test.ts drops to 1037 lines with the stale byte-stability mention removed from its header.

Acceptance criteria from the review all pass locally: src/canvas (40 tests), ui/src/lib/board + ui/src/components/board + ui/src/app (1047 tests, includes browser-link-routing), gateway sandbox suites (20 tests), and node scripts/check-changed.mjs green.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Both P2 findings are addressed in dc6b97309ee (middle-button routing via the native-link-routing predicate; bubble-phase listeners so widget preventDefault is honored), with live proof posted above and exact-head CI green.

@clawsweeper

clawsweeper Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit fd4404d into main Aug 23, 2026
237 checks passed
@steipete
steipete deleted the steipete/pr-127315-review-test-da8fd6 branch August 23, 2026 15:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 24, 2026
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant