Repository navigation
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This production WSL change alters listening addresses for the default local-only mode, and an unresolved high-severity finding indicates that a LAN or Tailscale address may still be selected, leaving the backend externally reachable. The test addition is harness-only, but the runtime exposure and security impact warrant human review. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
|
Pushed 8b4639934 addressing the review findings:
New test: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8b46399341df0021639b9a5d794601902d78bf66. Configure here.
|
Pushed 749286ce9 addressing both findings:
Protocol suite 7/7 including the override test (now driving the override through a Ref-backed Effect), backend configuration 34/34, tsgo and oxfmt clean on touched files. |
resolveWslStartConfig hardcoded a 0.0.0.0 bind regardless of the resolved DesktopServerExposure mode, so a local-only WSL backend answered on every distro interface (including tailscale0) while the UI claimed it was limited to this machine. Wildcard-binding now requires network-accessible exposure; local-only binds the renderer-visible host instead.
749286c to
f8444a1
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughWSL startup now selects its bind host from the server exposure mode. Network-accessible mode uses ChangesWSL bind host selection
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The updated binding behavior has no confirmed merge-blocking issue in the available evidence. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| // Instead, bind exactly the address the renderer is told to use: the distro | ||
| // IP in NAT mode (reachable from Windows without depending on flaky wslhost | ||
| // forwarding) or loopback in mirrored mode. | ||
| const wslBindHost = input.networkAccessible ? "0.0.0.0" : rendererHost; |
There was a problem hiding this comment.
🟠 High backend/DesktopBackendConfiguration.ts:643
Local-only WSL backends bind to an externally reachable address when getDistroIp returns a Tailscale or other non-WSL interface first, so the backend is reachable beyond the local machine. Because wslBindHost uses rendererHost directly, select the WSL vEthernet/eth0 address or reject non-WSL private addresses before using it here.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/desktop/src/backend/DesktopBackendConfiguration.ts around line 643:
Local-only WSL backends bind to an externally reachable address when `getDistroIp` returns a Tailscale or other non-WSL interface first, so the backend is reachable beyond the local machine. Because `wslBindHost` uses `rendererHost` directly, select the WSL vEthernet/`eth0` address or reject non-WSL private addresses before using it here.

Fixes #9056.
Problem
With the WSL backend enabled,
resolveWslStartConfighardcoded a0.0.0.0bind regardless of the resolvedDesktopServerExposuremode. With Network access off, the Connections panel states "Limited to this machine", but the WSL backend actually answers on every distro interface — includingtailscale0when Tailscale runs inside the distro, which exposes the backend to the entire tailnet with the toggle off (repro and curl evidence in the issue). The Windows primary already binds127.0.0.1in local-only mode viaresolveDesktopServerExposure; only the WSL path diverged.Change
resolveWslStartConfigasnetworkAccessible, read fromDesktopServerExposure.getStateat both call sites (the wsl-only primary and theresolveWslsecondary).network-accessiblemode the behavior is unchanged (0.0.0.0, for the reasons documented in the original comment — readiness probe and renderer reachability without depending on wslhost forwarding).local-onlymode, bind exactly the address the renderer is already told to use: the distro IP in NAT mode (reachable from Windows without depending on flaky wslhost forwarding, so the readiness-probe regression that motivated the wildcard bind does not come back) or loopback in mirrored mode. A wildcard bind is no longer possible while the UI claims "limited to this machine".No UI changes, so no screenshots are attached.
Tests
resolveWsl wildcards the WSL bind only when network access is enabled— guards the unchanged0.0.0.0behavior in network-accessible mode.resolveWsl binds the advertised distro IP when exposure is local-only— local-only + NAT binds the advertised host instead of the wildcard.resolveWsl binds loopback in mirrored mode when exposure is local-only— mirrored mode keeps loopback.Verification: focused suite
apps/desktop/src/backend/DesktopBackendConfiguration.test.ts— 34 passed;tsgo --noEmiton@t3tools/desktopreports no errors in the touched files;oxfmt --checkclean on both files.Note
Medium Risk
Changes WSL listen addresses and desktop protocol proxy targets, which affect reachability and local-only network exposure guarantees on Windows/WSL.
Overview
Fixes local-only server exposure for WSL-backed desktops: the WSL backend no longer always binds
0.0.0.0, which could expose it on distro interfaces (e.g. Tailscale) while the UI still says “limited to this machine.”WSL bind host now follows the primary’s exposure mode via
networkAccessiblefromDesktopServerExposure.getState: network-accessible keeps0.0.0.0; local-only binds the same address the renderer uses (distro IP in NAT,127.0.0.1in mirrored mode).Because local-only WSL primaries advertise a non-loopback URL, the custom
app://protocol can follow the backend once it’s ready:DesktopServerExposureaddsbackendProxyOrigin/noteResolvedBackendOrigin, the backend pool records the resolved origin ononReady, packaged local-only bootstrap passestargetOriginOverrideintoElectronProtocol, and the handler consults that override per request.Reviewed by Cursor Bugbot for commit 749286ce90bd2a2027378f98d114986b1a07c0d3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix WSL backend bind host to honor local-only exposure mode
0.0.0.0only when exposure mode is network-accessible; in local-only mode it binds to the distro IP (NAT) or loopback (mirrored), preventing unintended exposure on other interfaces. See DesktopBackendConfiguration.ts.backendProxyOriginandnoteResolvedBackendOrigintoDesktopServerExposureso the protocol proxy can follow a live backend-reported origin instead of a static loopback URL. See DesktopServerExposure.ts.proxyRequestin ElectronProtocol.ts with an optionalgetTargetOrigincallback; the protocol handler reads a dynamic target origin per request.noteResolvedBackendOriginwith the backend'shttpBaseUrlbefore opening the main window. See DesktopBackendPool.ts.resolveWslnow requires anetworkAccessibleflag; any caller not passing it will fail to compile. TheDesktopServerExposureinterface change requires all stubs to implementbackendProxyOriginandnoteResolvedBackendOrigin.📊 Macroscope summarized f8444a1. 1 file reviewed, 2 issues evaluated, 1 issue filtered, 1 comment posted
🗂️ Filtered Issues
apps/desktop/src/backend/DesktopBackendConfiguration.ts — 1 comment posted, 2 evaluated, 1 filtered
getDistroIpobtains its result fromhostname -I, which returns a non-loopback distro address, so theisLocalHostIpv4branch cannot detect mirrored WSL networking in production. Mirrored mode mirrors the Windows LAN interfaces into WSL; the selected address can therefore be a LAN address, and local-only mode binds the backend to it here. This exposes a backend that the UI labels local-only to the LAN instead of binding127.0.0.1for mirrored networking. [ Already posted ]Summary by CodeRabbit