Repository navigation
Conversation
Signed-off-by: Sebastien Tardif <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis 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
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete 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 Decision needed
Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherTray 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]
Technical reviewBest 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 817b0b586c1e. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: The proxy can authorize a replacement SSH listener while forwarding through an older foreign accepted connection. EvidenceSecurity concerns:
What I checked:
Likely related people:
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (24 earlier review cycles; latest 8 shown)
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]>
|
Global triage: HOLD_FOR_AUTHOR. Take confidence 25%; recommendation confidence 93%; effort moderate; risk high. Reviewed exact head |
…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]>
|
Thanks, Seb. The new pin checks and truthful credential-source reporting are useful. We independently reviewed the 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 The small correction is already available in this delta: use 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 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. |
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
…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]>
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]>
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]>
|
Global triage: HOLD_FOR_AUTHOR. Take confidence 20%; recommendation confidence 98%; effort medium; risk high. Reviewed exact head 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]>
|
Thanks, Seb. I rechecked the current head against current
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 Closing this PR so that narrower repair can proceed cleanly. Thank you for the persistence and the valuable investigation here. |
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 UIgatewayUrluses 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__andbasePathrewritten onto that session, so a follow-up asset request does not need a Referer.Referrer-Policyis still copied.Set-Cookieis forwarded, with Domain and Secure removed and Path placed under the session, because the browser origin ishttp://127.0.0.1. The live tray trace below is still60b1cc0eand 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 indashboard-origins.jsonand reused after the process map is cleared. The first gateway keeps127.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 still60b1cc0eand was not repeated on this head.26f07579was 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 from60b1cc0eand was not repeated on this head.5e28f41dwas 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 from60b1cc0eand was not repeated on this head.9cb62aa9was 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 from60b1cc0eand was not repeated on this head.18bebb66was green before this commit.Dashboard launches share
http://127.0.0.1:47831for 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 parent60b1cc0e. 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.exe21220 was its child and listened on127.0.0.1:45678.winnode --list-toolsincludedapp.dashboard.url. The call returnedhttp://127.0.0.1:63604/d/<nonce>withhasTokenQueryfalse,usesSharedGatewayTokentrue,credentialSourcerecord.SharedGatewayToken, and no token in that URL. The first request returned HTTP 200 and alocation.replacepage. The second request to the same URL returned HTTP 404 with an empty body and no token. After thatssh.exestopped, nothing listened on 45678, and the next call returnedDashboard blocked because the SSH tunnel is not upwith 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.exeprocess 30580 was a child of that tray.winnode --list-toolsincludedapp.dashboard.url.winnode --command app.dashboard.urlreturned:curl.exetohttp://127.0.0.1:45678/mount/?view=compactreturned HTTP 200. The same path over https returned no status. The tray log line wasSSH tunnel startedforrootat local port 45678 to remote port 18789. Stoppingssh.exe30580 left nothing listening on 45678. The nextapp.dashboard.urlcall returnedDashboard blocked because the SSH tunnel is not up.and no URL.On head
1d9bbac0e6d18288ecafe6ce4a50552185904778,wss://gateway.example/mount/?view=compact#sectionwith local port 45678 resolves towss://localhost:45678/mount/?view=compact#section. A plainws://gateway.example:18789still resolves tows://localhost:45678../build.ps1exit 0 ond94a9f770c0f1dbf2d5d757aeeae5b3b0e6e4de0. 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
42c562f91a42ae0251ac971c44f6ce0f8028e88dpreserves the original author commits and branch. Repair99ea745923d5d6edf113a8d2bf979f5db85615b1changes 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#tokenfragment, not a token query.Required proof pools
windows-winui-interactive: local MCPapp.dashboard.urlon head1d9bbac0, with the owned SSH listener up and then stopped. Headd94a9f77rechecks 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 head99ea745923d5d6edf113a8d2bf979f5db85615b1.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-restorecould not silently no-op..\build.ps1dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.WinNode.Cli.Tests\OpenClaw.WinNode.Cli.Tests.csproj --no-restoreTRX 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
DeviceIdentityand 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 withrefusing 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
1d9bbac0e6d18288ecafe6ce4a50552185904778, process 18504, isolated data directory, Ubuntu-24.04 gateway on port 18789,ssh.exe30580 parented by the tray. The recheck is headd94a9f770c0f1dbf2d5d757aeeae5b3b0e6e4de0.winnode --list-tools. Runwinnode --command app.dashboard.url --params {}. Requesthttp://127.0.0.1:45678/mount/?view=compact. Stop the tray'sssh.exe. Callapp.dashboard.urlagain./mount, queryview=compact, and fragment fieldssectionandtoken. The saved hostgateway.examplewas absent. The token length was 48 and it was a fragment field.usesSharedGatewayTokenwas true. The plain HTTP forward returned 200. After the ownedssh.exeexited, 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.10f8f2dd. An authenticated dashboard HTTP and WebSocket session through the SSH forward was not repeated on this head. The live tray trace remains60b1cc0e. 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.