Skip to content

fix(connection): open the dashboard on the tunnel, not the saved URL - #1484

Closed
SebTardif wants to merge 22 commits into
openclaw:mainfrom
SebTardif:fix/f020-dashboard-tunnel
Closed

SebTardif wants to merge 22 commits into
openclaw:mainfrom
SebTardif:fix/f020-dashboard-tunnel

Conversation

@SebTardif

@SebTardif SebTardif commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Open dashboard for an SSH gateway built the browser URL from the saved gateway URL and appended the shared token. The node socket is ws://localhost on the tunnel. A cleartext saved URL carried the token to the remote host.

Why

IsStrongCredentialAllowed treated every SSH record as allowed, so the managed-gateway check was skipped.

User Impact

The dashboard opens on localhost at the forwarded port and keeps the saved path, query, and fragment. The token is appended only to that tunnel URL. A down or different tunnel is refused. A browser failure uses the existing retry dialog and does not log the address.

Evidence

Current head: c50f40648ee0a6460813d69ffb1687b8cbd6c525.

A saved gateway keeps its loopback origin only while its saved URL and SSH target stay the same. Retargeting that record, including when the local forward port does not change, opens a new origin. An older dashboard-origins.json that stored only the gateway id keeps that port for the first destination and does not reuse it after a retarget. The one-use page is still /d/<nonce>. The Control UI gatewayUrl uses the saved session path /s/<session>/, and a second launch of the same destination keeps that URL. HTML and JSON from the Gateway have __OPENCLAW_CONTROL_UI_BASE_PATH__ and basePath rewritten onto that session, so a follow-up asset request does not need a Referer. Referrer-Policy is still copied. Set-Cookie is forwarded, with Domain and Secure removed and Path placed under the session, because the browser origin is http://127.0.0.1. The live tray trace below is still 60b1cc0e and was not repeated on this head.

Earlier head 10f8f2dd: a nonce is served only on the listener that issued it. A request to gateway A's port with gateway B's /s/<nonce>, or a Referer from B's origin, returns 404 and does not include B's page. Each gateway id is saved in dashboard-origins.json and reused after the process map is cleared. The first gateway keeps 127.0.0.1:47831. Later gateways keep their own saved ports. Accepted sockets are matched by the connected address and family. An IPv6 loopback listener in this process was attributed to this process. A chunked upstream response {"ok":true} was returned as that JSON, without the chunk sizes. The live tray trace below is still 60b1cc0e and was not repeated on this head. 26f07579 was green before this commit.

Each gateway now has its own loopback origin. The proxy forwards cookies, authorization, and the request body, and it rewrites root redirects back under the issuing /s/<nonce> path. The WebSocket uses the same accepted socket that was checked against the current listener before any frames are copied. The live tray trace below is from 60b1cc0e and was not repeated on this head. 5e28f41d was green before this commit.

Absolute dashboard links such as /assets/... are rewritten under the issuing /s/<nonce> path, and a later request can also be matched from its Referer. HTTP forwarding compares the accepted socket's process with the current listener before copying bytes. WebSocket certificates must match the saved gateway name even when the chain is otherwise valid. Gateway security headers are copied through. The live tray trace below is from 60b1cc0e and was not repeated on this head. 9cb62aa9 was green before this commit.

Each issued dashboard stays on its own /s/<nonce> path, so a later gateway does not take over an earlier tab. Proxied responses keep the upstream content type. TLS checks the saved gateway name instead of accepting any certificate for localhost. The connected socket's process is not yet compared with the SSH process. The live tray trace below is from 60b1cc0e and was not repeated on this head. 18bebb66 was green before this commit.

Dashboard launches share http://127.0.0.1:47831 for the life of the tray. An unused link expires after two minutes. The listener stays up. After the socket to the forward connects, ownership is checked again before any dashboard bytes are copied. The upstream scheme follows the saved destination, including HTTPS and WSS. The live tray trace below is parent 60b1cc0e. It was not repeated on this head.

The one-use page no longer sends the browser to the SSH forward. The follow-up address stays on the handoff listener, and that listener proxies to the forward only while ownership still holds. The live tray trace below is parent 60b1cc0ee03d04c2389ce820ce10922b4025e2e0, whose first response still named the tunnel address. That live tray was not repeated on this head.

The one-use page now keeps the gateway and tunnel that issued the link. If the active gateway changes before the browser requests the page, the token is not released.

An SSH dashboard link issued by the tray, the saved-row action, or local MCP is now http://127.0.0.1:<port>/d/<nonce> and does not contain the token. The first request writes the real dashboard address only when the owned listener still matches. A second request is HTTP 404 and does not contain the token. After the browser follows that page, its address bar can still show the tunnel URL.

Current-head tray process 18376. ssh.exe 21220 was its child and listened on 127.0.0.1:45678. winnode --list-tools included app.dashboard.url. The call returned http://127.0.0.1:63604/d/<nonce> with hasTokenQuery false, usesSharedGatewayToken true, credentialSource record.SharedGatewayToken, and no token in that URL. The first request returned HTTP 200 and a location.replace page. The second request to the same URL returned HTTP 404 with an empty body and no token. After that ssh.exe stopped, nothing listened on 45678, and the next call returned Dashboard blocked because the SSH tunnel is not up with no URL. A foreign process then listened on 45678, and the next call returned the same error with no URL. The browser was not opened. Switching the active gateway was not done on this live tray. The first 200 response body contains the tunnel address, so a browser that follows it can still open that port.

The tray, the saved-row action, and local MCP check the owned listener again immediately before the browser launch or before the link is returned. If that recheck fails, the browser is not opened and the link is not returned. A link that was already returned can still be opened later. The live trace below is parent 1d9bbac0e6d18288ecafe6ce4a50552185904778.

Isolated current-head tray, process 18504. The active saved gateway URL was wss://gateway.example/mount/?view=compact#section. Its SSH forward was local port 45678 to the Ubuntu-24.04 gateway port 18789. ssh.exe process 30580 was a child of that tray. winnode --list-tools included app.dashboard.url. winnode --command app.dashboard.url returned:

credentialSource record.SharedGatewayToken
usesSharedGatewayToken True
hasTokenQuery True
scheme https
host localhost
port 45678
path /mount
query view=compact
fragment keys section,token
token length 48
saved host present False

curl.exe to http://127.0.0.1:45678/mount/?view=compact returned HTTP 200. The same path over https returned no status. The tray log line was SSH tunnel started for root at local port 45678 to remote port 18789. Stopping ssh.exe 30580 left nothing listening on 45678. The next app.dashboard.url call returned Dashboard blocked because the SSH tunnel is not up. and no URL.

On head 1d9bbac0e6d18288ecafe6ce4a50552185904778, wss://gateway.example/mount/?view=compact#section with local port 45678 resolves to wss://localhost:45678/mount/?view=compact#section. A plain ws://gateway.example:18789 still resolves to ws://localhost:45678. ./build.ps1 exit 0 on d94a9f770c0f1dbf2d5d757aeeae5b3b0e6e4de0. Shared 4263 passed, 33 skipped, 4296 total. Tray 4001 passed, 0 failed. The saved-row menu and a browser window were not opened on this head.

Maintainer repair

Normal integration of main 42c562f91a42ae0251ac971c44f6ce0f8028e88d preserves the original author commits and branch. Repair 99ea745923d5d6edf113a8d2bf979f5db85615b1 changes only the pinned dashboard credential helper (10 added / 9 removed production lines) and two focused test files.

Paired SSH dashboard HTTP authentication now uses the existing shared-first InteractiveGatewayCredentialResolver.TryResolveRecord, not the device-first WebSocket resolver. Before/after pin checks, existing authorization semantics, owned-listener and endpoint binding, and the final shared-token equality gate remain. Device/bootstrap credentials never enter dashboard URLs. WebSocket precedence is unchanged. The HTTP browser URL builder uses a #token fragment, not a token query.

Required proof pools

  • windows-winui-interactive: local MCP app.dashboard.url on head 1d9bbac0, with the owned SSH listener up and then stopped. Head d94a9f77 rechecks that listener immediately before launch or before returning the link. The saved-row menu and a browser window were not opened.

Validation

Validated source tree: beae2a9b7790c4819df441690c6ba6e489dec1a6, repair head 99ea745923d5d6edf113a8d2bf979f5db85615b1.

Native Windows ARM64, SDK 10.0.400. Isolated tray data, worktree-specific OPENCLAW_REPO_ROOT, E2E flags off. Each test project was built first so --no-restore could not silently no-op.

Command Passed Skipped Failed
.\build.ps1 All projects N/A 0
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore 4096 35 0
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore 3073 0 0
dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore 812 5 0
dotnet test .\tests\OpenClaw.WinNode.Cli.Tests\OpenClaw.WinNode.Cli.Tests.csproj --no-restore 127 0 0

TRX result entries confirm these counts. Focused Connection resolver/gate/endpoint/credential tests: 48 passed. New tray/saved-row/MCP wiring guards: red 1 failed / 3 passed before the repair; green 4 passed after it. The behavioral cases use a real isolated persisted DeviceIdentity and production credential resolvers with fabricated tokens, including paired shared-token selection, device/bootstrap exclusion, authorization rejection, and changed-pin/shared-token mismatch controls.

Focused full-source rubber-duck review and parent inspection of the exact repair passed with no blockers. Structured autoreview could not start: python .\.agents\skills\autoreview\scripts\autoreview --mode commit --commit 99ea745923d5d6edf113a8d2bf979f5db85615b1 --engine codex (using the approved Codex 0.156.1 executable) exited 1 before engine invocation. Its bundle scanner rejected plainly synthetic token fixtures and source-field expressions with refusing to include secret-like content in review bundle; clean or redact commit diff before running autoreview. No scanner was weakened, no source-altering review mirror or alternate engine was used, and no clean autoreview result is claimed. After inspecting these false positives and the full repair, the parent authorized publication as a reviewable maintainer update, not merge/ship approval. The outstanding structured-review and live-proof limitations remain visible.

Real behavior proof

  • Behavior or issue addressed: An SSH dashboard link keeps the saved path, query, and fragment, and moves only the host and port onto the owned local forward. The owned-listener check runs again immediately before the browser starts or before the link is returned. When that check fails, the browser stays closed and no link is returned.
  • Real environment tested: Windows 11. The live tray trace is head 1d9bbac0e6d18288ecafe6ce4a50552185904778, process 18504, isolated data directory, Ubuntu-24.04 gateway on port 18789, ssh.exe 30580 parented by the tray. The recheck is head d94a9f770c0f1dbf2d5d757aeeae5b3b0e6e4de0.
  • Exact steps or command run after this patch: Launch the isolated tray. Run winnode --list-tools. Run winnode --command app.dashboard.url --params {}. Request http://127.0.0.1:45678/mount/?view=compact. Stop the tray's ssh.exe. Call app.dashboard.url again.
  • Evidence after fix: terminal output from the current-head tray:
HAS_DASHBOARD True
credentialSource record.SharedGatewayToken
usesSharedGatewayToken True
scheme https
host localhost
port 45678
path /mount
query view=compact
fragment keys section,token
token length 48
saved host present False
HTTP 200
after stop: Dashboard blocked because the SSH tunnel is not up.
  • Observed result after fix: The link used localhost port 45678, path /mount, query view=compact, and fragment fields section and token. The saved host gateway.example was absent. The token length was 48 and it was a fragment field. usesSharedGatewayToken was true. The plain HTTP forward returned 200. After the owned ssh.exe exited, the port was closed and the next call returned the tunnel-down error with no URL. On the new head, a failed ownership recheck returns before the browser delegate runs.
  • What was not tested: The saved-row menu and a browser window were not clicked on head 10f8f2dd. An authenticated dashboard HTTP and WebSocket session through the SSH forward was not repeated on this head. The live tray trace remains 60b1cc0e. Browser storage that lived on the old gateway host is not copied into the loopback origin. Switching the active gateway was not done on the live tray. Bootstrap and changed-pin refusals were not repeated.

@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge.

What this changes

This PR routes SSH dashboards through credential-free loopback launch links and a persistent, gateway-specific HTTP and WebSocket proxy.

Example: Open an SSH gateway saved as ws://gateway.example:18789 with local forward port 45678.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The latest source changes address the previous four findings, but an actionable security race and closed-owner violation remain; current proxy runtime and persisted-profile compatibility evidence are insufficient.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Opening an SSH dashboard can use the saved remote address instead of the verified local forward and expose credentials to the wrong endpoint.
Reason: The bug merits repair and the shared-first credential correction has maintainer direction; the later persistent proxy and browser storage contract require a separate scope decision.

Merge readiness

⛔ Blocked before merge - 7 items remain

Keep this PR open: main still has the dashboard-routing problem, but the proxy retains a security race and reintroduces dashboard policy into a closed App responsibility. The latest commit addresses the four previous finding titles.

Priority: P1
Reviewed head: c50f40648ee0a6460813d69ffb1687b8cbd6c525
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should this repair introduce a persistent browser-origin store and application-layer dashboard proxy, or consolidate with the retained-forward approach in fix(connection): Open Dashboard can send the token before the SSH forward owns the port #1514?
  • Recommendation: Consolidate the overlapping repairs: Choose one tunnel handoff owner across both PRs and retain the existing dashboard launcher contract.
  • Why: The recorded maintainer decision authorizes the shared-first credential correction, but does not establish direction for the later persistent proxy, browser-origin change, and cookie adaptation.

Before merge

  • Add real behavior proof - Authority-chain proof required: the real tray/MCP trace on 60b1cc0 predates the proxy. Show the current implementation authenticating through browser HTTP and WebSocket, refusing a foreign accepted backend before credential or content bytes, and invalidating switched, retargeted, or stopped bindings before forwarding. Include same-record retarget isolation and redact credentials and private endpoints; the inspected screenshots show adjacent connection/error UI. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Bind the accepted backend to the authorized SSH process (P1) - BackendIsOwned accepts any connection whose accepted PID equals the listener PID in its snapshot. Suppose the initial session check passes, SSH exits, and a foreign listener accepts the proxy connection. This comparison passes while that foreign listener is present. If it closes its listening socket but retains the accepted connection, and SSH recovery rebinds the port before the subsequent _owned() call, that independent callback also passes. ProxyAsync then writes Cookie/Authorization headers and request content to the foreign connection; the WebSocket path has the same gap before forwarding authentication frames. Compare the accepted connection directly with a captured authorized SSH process/start time and generation, with conditional invalidation before forwarding. This is a late discovery: targeted blame and the previous-head diff confirm the checks were already equally visible at 77fe88d.
  • Return dashboard construction and credential policy to the launcher (P2) - For an active saved SSH gateway, OpenDashboard now enters OpenDashboardAsync, which chooses the credential-export decision and constructs the URL inline before passing a prepared URL to the launcher. The base ledger's app-dashboard-launch-closed row explicitly prohibits App regaining parallel dashboard URL or credential policy. This PR therefore reintroduces the closed responsibility alongside the existing launcher path, with further copies in MCP and the saved-row action. Move the cohesive SSH dashboard preparation into the existing launcher or a focused owner it delegates to, leaving App as composition and entry forwarding. This is a late policy finding: the previous-head comparison shows the cited construction was already present at 77fe88d.
  • Resolve security concern: Accepted transport and authorization identify different processes - The finding applies to both HTTP credential-bearing headers/body and WebSocket authentication traffic; listener ownership alone does not establish the principal behind an already accepted socket.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.
  • Explain or restore the original intent of Dashboard launch ownership - 3eed1f1: The launcher and architecture ledger place ordinary dashboard construction and browser-result handling outside App, retaining App as composition root.

Findings

  • [P1] Bind the accepted backend to the authorized SSH process — src/OpenClaw.Tray.WinUI/Services/DashboardCredentialHandoff.cs:854-858
  • [P2] Return dashboard construction and credential policy to the launcher — src/OpenClaw.Tray.WinUI/App.xaml.cs:4170-4176
  • [high] Accepted transport and authorization identify different processes — src/OpenClaw.Tray.WinUI/Services/DashboardCredentialHandoff.cs:858

Provenance

  • Dashboard launch ownership changes intended behavior without addressing why it exists (3eed1f1: The launcher and architecture ledger place ordinary dashboard construction and browser-result handling outside App, retaining App as composition root.)

Tests

  • Low-value test tests/OpenClaw.Tray.Tests/SetupDashboardHandoffTests.cs: Remove the standalone ResourceBaseAndCookieFollowTheSession helper assertions where the socket-backed ProxiesSessionAssetsWithoutRefererAndKeepsCookies regression already exercises the same transformations.
  • Missing end-to-end proof: Missing current-implementation authenticated browser HTTP/WebSocket proof, foreign-backend and invalidated-binding controls, and an existing-profile upgrade run; base-failing regression results for the latest additions are not supplied.
Agent review details

How this fits together

Tray actions, saved-gateway actions, and app.dashboard.url resolve browser credentials and tunnel endpoints; the new handoff service serves browser requests and forwards them through the SSH listener to the Gateway.

flowchart LR
 A[Tray or MCP action] --> B[Gateway record and HTTP credential]
 B --> C[Dashboard launch gate]
 C --> D[Loopback handoff and session proxy]
 D --> E[Owned SSH forward]
 E --> F[Gateway dashboard]
 D --> G[Browser]
Loading

Technical review

Best possible solution:

Keep dashboard policy in the existing launcher and bind every accepted backend socket to the authorized SSH process and generation before forwarding.

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

Main's launcher and saved-row action build dashboard URLs from the saved remote address; source inspection also establishes the introduced accepted-socket replacement race, without executing target code.

Is this the best way to solve the issue?

The HTTP credential correction preserves the intended contract, but the expanded proxy should use generation-bound SSH authority and the existing launcher owner rather than parallel App policy.

Full review comments:

  • [P1] Bind the accepted backend to the authorized SSH process — src/OpenClaw.Tray.WinUI/Services/DashboardCredentialHandoff.cs:854-858
    BackendIsOwned accepts any connection whose accepted PID equals the listener PID in its snapshot. Suppose the initial session check passes, SSH exits, and a foreign listener accepts the proxy connection. This comparison passes while that foreign listener is present. If it closes its listening socket but retains the accepted connection, and SSH recovery rebinds the port before the subsequent _owned() call, that independent callback also passes. ProxyAsync then writes Cookie/Authorization headers and request content to the foreign connection; the WebSocket path has the same gap before forwarding authentication frames. Compare the accepted connection directly with a captured authorized SSH process/start time and generation, with conditional invalidation before forwarding. This is a late discovery: targeted blame and the previous-head diff confirm the checks were already equally visible at 77fe88d.
    Confidence: 0.94
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Return dashboard construction and credential policy to the launcher — src/OpenClaw.Tray.WinUI/App.xaml.cs:4170-4176
    For an active saved SSH gateway, OpenDashboard now enters OpenDashboardAsync, which chooses the credential-export decision and constructs the URL inline before passing a prepared URL to the launcher. The base ledger's app-dashboard-launch-closed row explicitly prohibits App regaining parallel dashboard URL or credential policy. This PR therefore reintroduces the closed responsibility alongside the existing launcher path, with further copies in MCP and the saved-row action. Move the cohesive SSH dashboard preparation into the existing launcher or a focused owner it delegates to, leaving App as composition and entry forwarding. This is a late policy finding: the previous-head comparison shows the cited construction was already present at 77fe88d.
    Confidence: 0.98
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 817b0b586c1e.

Provenance checked

  • Browser HTTP credential selection keeps the original intent (ef0240f: The merged setup/connection correction established shared-first HTTP credentials separately from device-first WebSocket credentials; the maintainer discussion on this PR confirms that distinction.)
  • SSH listener ownership keeps the original intent (603886a: Existing ownership checks bind strong credential handoffs to the manager-owned SSH process, configuration, and generation; later work adds generation-conditional cleanup.)
  • Saved-address dashboard routing changes intended behavior with a stated reason (672aadc: The Connection page rebuild supplied the saved-row dashboard action; this PR explains why using its saved remote endpoint is unsafe for SSH records.)

Testing

Proof path: in-process harness.

Security

Needs attention: The proxy can authorize a replacement SSH listener while forwarding through an older foreign accepted connection.

Evidence

Security concerns:

  • [high] Accepted transport and authorization identify different processes — src/OpenClaw.Tray.WinUI/Services/DashboardCredentialHandoff.cs:858
    The finding applies to both HTTP credential-bearing headers/body and WebSocket authentication traffic; listener ownership alone does not establish the principal behind an already accepted socket.
    Confidence: 0.94

What I checked:

Likely related people:

  • Scott Hanselman: Raw commit a51029e adds src/OpenClaw.Connection/SshTunnelService.cs:652 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a51029ef6f77; files: src/OpenClaw.Connection/SshTunnelService.cs)
  • Ranjesh: Raw commit ef0240f adds src/OpenClaw.Tray.WinUI/Services/Connection/InteractiveGatewayCredentialResolver.cs:40 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ef0240f17ceb; files: src/OpenClaw.Tray.WinUI/Services/Connection/InteractiveGatewayCredentialResolver.cs)

Review metrics

Metric Value Why it matters
Introduced production and test growth Production +1772/-57 lines; tests and test project +793/-0 lines Most production growth comes from the 918-line proxy; its persistent architecture needs an owner decision beyond the narrow credential repair.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The changed credential handoff can forward authenticated dashboard traffic to a foreign accepted socket during listener replacement.
  • merge-risk: 🚨 security-boundary: Accepted-backend attribution and SSH authorization are independent snapshots rather than one process-bound authority check.
  • merge-risk: 🚨 compatibility: The PR changes browser origins and gateway URLs, adapts cookies, and introduces persisted dashboard-origin state without an established existing-profile upgrade result.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (24 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-08T21:25:26.954Z sha e8f4d2c :: needs real behavior proof before merge. :: [P1] [P1] Preserve the upstream asset content type | [P1] [P1] Keep each browser session bound to its issuing gateway | [P1] [P1] Verify the connected backend rather than its current listener | [P1] [P1] Preserve the saved TLS identity on both upstream transports | [P1] [P1] Forward the Gateway's browser security headers | [P2] [P2] Preserve existing dashboard preferences across the origin change
  • reviewed 2026-10-08T21:54:47.596Z sha a6f5e2e :: needs real behavior proof before merge. :: [P1] [P1] Preserve the upstream asset content type | [P1] [P1] Keep each browser session bound to its issuing gateway | [P1] [P1] Verify the connected backend rather than its current listener | [P1] [P1] Preserve the saved TLS identity on both upstream transports | [P1] [P1] Forward the Gateway's browser security headers | [P2] [P2] Preserve existing dashboard preferences across the origin change
  • reviewed 2026-10-08T22:10:46.974Z sha 18bebb6 :: needs real behavior proof before merge. :: [P1] [P1] Preserve the upstream asset content type | [P1] [P1] Keep each browser session bound to its issuing gateway | [P1] [P1] Verify the connected backend rather than its current listener | [P1] [P1] Preserve the saved TLS identity on both upstream transports | [P1] [P1] Forward the Gateway's browser security headers | [P2] [P2] Preserve existing dashboard preferences across the origin change
  • reviewed 2026-10-08T23:10:43.479Z sha 9cb62aa :: needs real behavior proof before merge. :: [P1] [P1] Keep absolute dashboard resource requests inside their session | [P1] [P1] Verify the connected backend before forwarding bytes | [P1] [P1] Validate the saved hostname for every WebSocket certificate | [P1] [P1] Preserve the Gateway's browser security headers | [P2] [P2] Preserve browser preferences across the new storage scope
  • reviewed 2026-10-09T00:03:03.109Z sha 5e28f41 :: needs real behavior proof before merge. :: [P1] [P1] Attribute the accepted WebSocket backend before forwarding frames | [P1] [P1] Give different Gateways separate browser origins | [P1] [P1] Forward authentication headers and HTTP request bodies | [P1] [P1] Preserve redirects within the issuing dashboard session | [P2] [P2] Preserve browser preferences with a stable Gateway scope | [P2] [P2] Match accepted connections for the selected address family
  • reviewed 2026-10-09T00:32:13.698Z sha 26f0757 :: needs real behavior proof before merge. :: [P1] [P1] Bind session dispatch to the listener's assigned gateway origin | [P2] [P2] Preserve a stable browser profile across tray restarts | [P2] [P2] Attribute the actual IPv4 or IPv6 backend connection | [P2] [P2] Decode upstream HTTP framing before returning the body
  • reviewed 2026-10-09T01:23:41.309Z sha 10f8f2d :: needs real behavior proof before merge. :: [P1] [P1] Allocate a new browser origin when a saved Gateway is retargeted | [P2] [P2] Keep runtime resource requests inside the dashboard session | [P2] [P2] Keep a stable Gateway URL within the saved browser origin | [P2] [P2] Preserve upstream authentication cookies in proxy responses
  • reviewed 2026-10-09T01:51:35.242Z sha 77fe88d :: needs real behavior proof before merge. :: [P1] [P1] Allocate a new browser origin when a saved Gateway is retargeted | [P2] [P2] Keep runtime resource requests inside the dashboard session | [P2] [P2] Keep a stable Gateway URL within the saved browser origin | [P2] [P2] Preserve upstream authentication cookies in proxy responses

Reviewed October 13, 2026, 8:41 PM ET / October 14, 2026, 00:41 UTC (Revision 25).

Require the SSH server port and a verified listener before a dashboard URL can carry a shared token, and read the token from the same gateway record as the tunnel.

Signed-off-by: Sebastien Tardif <[email protected]>
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 23, 2026
@karkarl

karkarl commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Global triage: HOLD_FOR_AUTHOR. Take confidence 25%; recommendation confidence 93%; effort moderate; risk high.

Reviewed exact head acb5744a9336. Tunnel/listener binding is good hardening, but the head appends pinned.SharedGatewayToken whenever non-empty, dropping the credential-precedence gate from the earlier commit. A device-token-paired SSH gateway can expose its stored shared token in the browser URL. Restore the source/bootstrap gate, stop hardcoding shared-token credential source in MCP output, and surface pin mismatch or async failures. Add windows-wsl-gateway-e2e, windows-winui-interactive, and winnode/MCP invocation proof for app.dashboard.url.

…ecord

An SSH dashboard was always appending the shared token and labeling that as the MCP source. The URL now follows the pinned record's credential source, and a pin mismatch returns no token URL.

Signed-off-by: Sebastien Tardif <[email protected]>
@shanselman

Copy link
Copy Markdown
Collaborator

Thanks, Seb. The new pin checks and truthful credential-source reporting are useful. We independently reviewed the acb5744a to 51c2586a007010f9cd1038060815698dca62372a delta with Opus 5.5 and GPT-5.6 Sol, then checked the source.

One correction to the earlier precedence feedback: operator WebSocket authentication and browser dashboard authentication use different resolvers. Keeping a device token ahead of a shared token for an operator connection does not mean a browser can authenticate with that device token.

The new TryResolvePinnedDashboardCredential calls CredentialResolver.ResolveOperator. For a normal paired SSH record containing both an operator device token and a shared token, it selects the device token. DashboardCredentialGate correctly refuses to put that device token in the browser link, but the result is now a tokenless dashboard link. Direct dashboard/chat paths still use the shared-first HTTP contract. Both reviewers independently identified this paired-SSH automatic-authentication regression.

The small correction is already available in this delta: use InteractiveGatewayCredentialResolver.TryResolveRecord for the pinned browser credential, retaining the existing authorization callback, listener ownership, before/after pin checks, and final shared-token equality gate. Do not put device or bootstrap tokens into the dashboard link, and do not change WebSocket precedence.

Please add a regression that actually invokes the resolver with both a stored device token and a shared token, rather than supplying a preselected source to DashboardCredentialGate. Cover the tray, saved-row, and app.dashboard.url paths against the same owned SSH record, then collect the current-head browser/MCP proof.

This is not a request for a new authentication framework or a general token-link redesign. The separate active-record-switch observation already exists at the prior reviewed head, and no specific closed architecture-ledger responsibility was established as newly violated; neither is being added as a new delta blocker.

@shanselman shanselman added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 23, 2026
shanselman and others added 2 commits September 24, 2026 01:44
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 5ec217af-d09a-475f-8c7c-1153efc34eae
Resolve the pinned dashboard credential with the existing shared-first HTTP resolver while preserving authorization, pin checks, and the final token gate. Add stored-identity regression coverage and tray, saved-row, and MCP wiring guards.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 5ec217af-d09a-475f-8c7c-1153efc34eae
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 24, 2026
…nnel

Signed-off-by: Sebastien Tardif <[email protected]>

# Conflicts:
#	src/OpenClaw.Connection/InteractiveGatewayCredentialResolver.cs
#	src/OpenClaw.Tray.WinUI/App.xaml.cs
#	src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml.cs
#	tests/OpenClaw.Tray.Tests/AppRefactorContractTests.cs
…the shared authorizer

The merge left a direct managed-port check on the pinned dashboard path.
HTTP surfaces now ask InteractiveGatewayEndpointAuthorizer, which still
applies that check for a non-native gateway and adds native ownership inspection.

Signed-off-by: Sebastien Tardif <[email protected]>
The UI job aborted after five minutes of host inactivity during markdown and workspace layout tests. Those tests are not part of this dashboard change.

Signed-off-by: Sebastien Tardif <[email protected]>
An SSH dashboard address such as wss://host/mount/?view=compact#section
now opens on localhost at the forwarded port and keeps the path, query,
and fragment. Browser launch goes through GatewayDashboardLauncher, so
a failure shows the existing retry dialog and the token URL is not logged.

The mounted-address resolver case passed. build.ps1 exit 0. Shared
4263 passed, 33 skipped. Tray 4000 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 7, 2026
The listener check that builds a dashboard link can be stale by the time
the browser starts. The tray, the saved-row action, and local MCP check
the owned listener again immediately before launch or before returning
the link. A failed recheck does not open the browser and does not return
the URL.

./build.ps1 passed. Shared 4263 passed, 33 skipped, 4296 total. Tray
4001 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
The ownership recheck still returned a reusable token fragment aimed at
the tunnel port. SSH dashboard opens and local MCP now issue a loopback
page with no credential. That page writes the token only after a fresh
ownership check, and a second request does not.

./build.ps1 passed. Shared 4263 passed, 33 skipped, 4296 total. Tray
4002 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
…d it

The one-use page checked whichever gateway was active and treated a
gateway with no SSH tunnel as ready. Switching away from the SSH
gateway before the browser requested the page could release the first
gateway's token. The check now requires the active record to still be
the issued gateway and its tunnel.

./build.ps1 passed. Shared 4263 passed, 33 skipped, 4296 total. Tray
4003 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
The one-use page sent the browser to the SSH forward with the token
in the address. A process that binds that port after the response can
read the fragment. The page now stays on the handoff listener and
proxies to the forward only while ownership still holds.

./build.ps1 passed. Shared 4263 passed, 33 skipped, 4296 total. Tray
4003 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 8, 2026
The handoff listener used a new port and closed after two minutes, so a
reload lost the Control UI profile and freed that origin. It also sent
bytes to the forward before checking that the SSH process still owned
the port, and it downgraded loopback TLS to plain HTTP. Launches now
share 127.0.0.1:47831 for the life of the tray. Unused links expire.
Connected sockets are checked again before any dashboard bytes move,
and the upstream scheme follows the saved destination.

./build.ps1 passed. Shared 4263 passed, 33 skipped, 4296 total. Tray
4003 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
The UI job on run 37845784723 aborted because the test host exited.
The tests named at the crash were markdown list layout and workspace
session layout. Tray, Setup and connect E2E, and the other product
checks passed.

Signed-off-by: Sebastien Tardif <[email protected]>
ConcurrentCreationConvergesOnOneCredential failed on run 37848102774
because api-credential.dpapi was in use by another process. UI passed
on this tree. The dashboard handoff does not touch that store.

Signed-off-by: Sebastien Tardif <[email protected]>
The proxy marked every response as HTML, and the newest handoff
replaced the backend for every earlier tab. Each issued link now keeps
its own /s/<nonce> path. Proxied responses keep the upstream content
type. TLS uses the saved gateway name instead of accepting any
certificate for localhost.

./build.ps1 passed. Shared 4263 passed, 33 skipped, 4296 total. Tray
4003 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
Gateway pages request /assets from the site root, so a session prefix
on the document alone returned 404. Absolute links in HTML are rewritten
under /s/<nonce>, and a later request is matched from its Referer.
HTTP forwarding now requires the accepted socket's process to be the
current listener before any bytes are copied. WebSocket certificates
must match the saved gateway name. Security headers from the gateway
are copied through.

./build.ps1 passed. Shared 4263 passed, 33 skipped, 4296 total. Tray
4003 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
Each gateway now gets its own loopback origin, so one dashboard cannot
read another's browser storage. The proxy forwards cookies, authorization,
and the request body, and it rewrites redirects back under the issuing
session. The WebSocket uses the same accepted socket that was checked
against the current listener before any frames are copied.

./build.ps1 passed. Shared 4263 passed, 33 skipped, 4296 total. Tray
4003 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
A session nonce is served only by the listener that issued it, including Referer fallback. Each gateway keeps the loopback port in dashboard-origins.json, and the first gateway keeps port 47831. Accepted sockets match the connected address family and endpoint, including IPv6. Chunked upstream responses are decoded before the browser reads them.

Cross-origin nonce requests return 404. A saved port survives an in-memory reset. An IPv6 loopback connection matches this process. A chunked JSON upstream returns the decoded object.

./build.ps1 passed. Shared 4263 passed / 33 skipped / 4296. Tray 4007 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
The UI job aborted after 448 passed tests. The host died with 0xC0000005 in Marshal.Release during a COM finalizer. The named test was GatewayFixtureUiTests.FixtureGuardAndActualSetupResolverUseTheSameEffectiveLocalDirectory, and the log says that test may not be the source. No assertion failed. This is not the earlier markdown renderer host abort.

Signed-off-by: Sebastien Tardif <[email protected]>
@karkarl

karkarl commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Global triage: HOLD_FOR_AUTHOR. Take confidence 20%; recommendation confidence 98%; effort medium; risk high.

Reviewed exact head 77fe88df9eb0. GitHub currently reports CLEAN with 24 passing, 0 failing, and 0 pending checks. needs-proof label is present. Durable automated signal: Codex review: needs real behavior proof before merge..

Author: resolve the current durable review findings, add focused regressions, and request a fresh exact-head review.

This is a triage classification, not a merge action. No branch changes were made.

A saved gateway id no longer keeps the previous destination's browser
origin. The one-use launch nonce stays off gatewayUrl, the Control UI
base path carries the saved session, and upstream Set-Cookie headers
reach the loopback page.

Tests cover a retarget with the same local forward, a legacy origin
file, a stable gatewayUrl, the declared base path, and proxied cookies.

Signed-off-by: Sebastien Tardif <[email protected]>
@shanselman

Copy link
Copy Markdown
Collaborator

Thanks, Seb. I rechecked the current head against current main and the architecture ledger. The useful intent is still valid, but two release blockers remain:

  • The proxy authorizes listener ownership separately from the already accepted backend socket. During listener replacement, credential-bearing HTTP or WebSocket traffic can still be forwarded through a foreign accepted connection.
  • Dashboard URL construction and credential-export policy have moved back into App, despite the app-dashboard-launch-closed architecture boundary assigning that responsibility to GatewayDashboardLauncher or a focused owner it delegates to.

At 2,565 changed lines, including a persistent application-layer proxy, this is no longer safely repairable as a small contributor patch. The useful intent should return as a narrower PR from current main, preserving the existing dashboard launcher ownership and binding the accepted transport directly to generation-aware SSH process authority.

Closing this PR so that narrower repair can proceed cleanly. Thank you for the persistence and the valuable investigation here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants