fix(server): do not HTTP-probe unknown local listeners - #8561
iamshadmantaqi wants to merge 2 commits into
Conversation
lsof discovery currently HTTP-probes every local listener, including binary RPC sockets. Record that only curated ports, configured Preview URLs, and T3 terminal PIDs should be probed.
Preview discovery still classifies HTTP servers, but it no longer GET every listening socket on the machine. Curated dev ports, configured Preview URLs, and registered T3 terminal PIDs stay eligible. Closes pingdotgg#8407
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, self-contained server bug fix that prevents HTTP traffic from being sent to unrelated local binary listeners while preserving configured previews, common development ports, and T3 terminal-owned listeners. Regression tests cover both the no-probe and preserved-probe paths. You can add or adjust custom eligibility rules. Learn more. |
Mnigos
left a comment
There was a problem hiding this comment.
Checked this locally: merges cleanly onto current main and the eligibility gate does what it says. One thing worth knowing before it closes #8407 outright: the ~10s TLS stall in the Steam trace is undici keeping an in-flight connect alive after the fetch is aborted (see my note on #8407), so a binary service on a curated port or from a T3 terminal still gets probed and still blocks for 10s. Might be cleaner to say this PR narrows the blast radius and leave #8407 open for the socket cleanup.
What Changed
PortDiscoverystill HTTP-probes listeners so Preview can hide MySQL and Redis. It no longer GETs every local TCP socket.A discovered listener is probed only when it is a curated dev port, a registered T3 terminal PID, or a configured Preview URL.
Why
#6021 added HTML probes to classify servers. The classification is correct, but the probe itself writes HTTP onto unrelated binary listeners. #8407 reproduces that against thinkorswim's JxBrowser RPC socket:
lsoffinds a random high port, T3 sendsGET /over HTTP then HTTPS, and the other app crashes during login.Configured Preview URLs and ordinary Vite/webpack ports still get probed.
Closes #8407
Blast Radius
Preview port discovery on macOS and Linux
lsof, and the Windows listener scan. Non-HTTP services on curated ports are still probed, then excluded, same as today. Random system listeners are left untouched.Verification
Failing-then-passing regression in
apps/server/src/preview/PortScanner.test.ts.vp linton the two changed files: 0 errors.vp run --filter t3 typecheck: no errors in the changed file.No UI chrome changed, so no screenshots.
Checklist
Note
Medium Risk
Changes preview port-scan behavior on macOS/Linux and Windows fallback paths; misclassification could hide a dev server on a non-curated port, but configured URLs and terminal PIDs still get probed.
Overview
Preview port discovery no longer sends HTTP(S) GET probes to every TCP listener
lsoffinds on macOS/Linux. Discovered sockets are probed only when they sit on a curated dev port (e.g. Vite/webpack) or belong to a registered T3 terminal PID; configured Preview URLs are still probed as before.This avoids writing HTTP onto unrelated binary/RPC listeners (e.g. random high ports from other apps) while keeping normal dev-server and terminal-owned port discovery. Tests cover a high port with no probe until
registerTerminalProcessesmaps the PID.Reviewed by Cursor Bugbot for commit abaad2b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Skip HTTP probing for unknown local listeners in
PortDiscovery.scanDiscovered listeners are now only HTTP-probed when on a curated dev port, owned by a registered T3 terminal, or named in a configured Preview URL. Adds
isEligibleDiscoveredWebProbein PortScanner.ts to gate probe URL construction and avoid sending HTTP to binary RPC listeners.PortDiscovery.scan()resultsMacroscope summarized abaad2b.