Fix canvas WebView2 surface auth via plugin-node cap URL#588
Fix canvas WebView2 surface auth via plugin-node cap URL#588christineyan4 wants to merge 1 commit into
Conversation
The Windows tray's Canvas WebView2 was hitting 401 when navigating to /__openclaw__/canvas/* paths because it built URLs against the gateway origin only, omitting the plugin-node capability token the gateway requires for cross-node plugin surface routes. The gateway already advertises a cap-scoped surface URL in its hello-ok response (pluginSurfaceUrls.canvas), e.g. http://<gateway>/__openclaw__/cap/<token> This change plumbs that URL through to CanvasWindow and uses it as the base for /__openclaw__/canvas/* rewrites, and as an additional trusted origin prefix in IsUrlSafe so a cap URL whose host doesn't match _trustedGatewayOrigin (e.g. 127.0.0.1 cap vs localhost origin) is not rejected by the safety check. Also clears the cached cap URL when a subsequent hello-ok/health update omits the canvas key, so a rotated/revoked token doesn't leave the node using a stale URL. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codex review: needs real behavior proof before merge. Reviewed June 17, 2026, 3:38 PM ET / 19:38 UTC. Summary Reproducibility: no. high-confidence live reproduction is included. Source inspection shows current main rewrites relative Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Validate the advertised canvas surface URL as an absolute http(s) cap route, propagate empty or missing canvas-surface updates through the client and any open Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction is included. Source inspection shows current main rewrites relative Is this the best way to solve the issue? No for the current branch. The cap-scoped routing approach is likely the right narrow fix, but the implementation needs URL validation and complete stale-cap clearing before it is safe to merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6811d6a3e21b. Label changesLabel justifications:
Evidence reviewedSecurity concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Problem
The Windows tray's Canvas WebView2 hits 401 Unauthorized when navigating to
/__openclaw__/canvas/*paths because it builds URLs against the gateway origin only, omitting the plugin-node capability token the gateway requires for cross-node plugin surface routes.Fix
The gateway already advertises a cap-scoped surface URL in its
hello-okresponse underpluginSurfaceUrls.canvas(e.g.http://<gateway>/__openclaw__/cap/<token>). This PR plumbs that URL through toCanvasWindowand uses it as the base for/__openclaw__/canvas/*rewrites.Additionally:
IsUrlSafeso a cap URL whose host doesn't match_trustedGatewayOrigin(e.g.127.0.0.1cap vslocalhostorigin) isn't rejected by the safety check.hello-ok/healthupdate omits the canvas key, so a rotated/revoked token doesn't leave the node using a stale URL.Files changed
src/OpenClaw.Shared/Models.cspluginSurfaceUrls.canvasfromhello-oksrc/OpenClaw.Shared/WindowsNodeClient.csCanvasSurfaceUrl; clear when canvas key absentsrc/OpenClaw.Tray.WinUI/Services/NodeService.csCanvasWindowon connect + on updatesrc/OpenClaw.Tray.WinUI/Windows/CanvasWindow.xaml.cs/__openclaw__/canvas/*via cap base; trust asIsUrlSafeprefixNet: +128 / -14 across 4 files. No new files, no API changes outside the tray.
Testing
net10.0-windows10.0.22621.0 / win-arm64(0 warnings, 0 errors)canvas.presentwith/__openclaw__/canvas/generative-art.htmlnow renders the real content instead of the dashboard SPA shell / 401 page.Known limitations (deferred)
canvas.presentand the dispatcher-enqueuedSetTrustedGatewayOrigin— theoretical, never observed.https://gw/__openclaw__/canvas/*) still go through the gateway origin path; gateway doesn't currently emit those.