GeezerVison is showing github.com — fix(desktop): preview tunnel listeners check the connection owner on macOS by juliusmarminge · Pull Request #41988 · pingdotgg/t3code
Conversation
The loopback tunnel's SOCKS listener and its forwarded ports serve only connections the system attributes to the current OS user. Linux reads that from /proc/net/tcp; macOS had no lookup. This adds one:
- macOS:
/usr/sbin/lsof -nP -iTCP@<client> -F un, matching the client's socket and comparing its uid.
On Linux and macOS a connection whose owner cannot be read is refused. On Linux that now also holds when the app has no user id to compare against. Windows is unchanged: its listeners do not check the owner. docs/internals/05_remote.md states the rule as it now is.
Cost
On macOS each tunnelled connection waits for the lookup, about 15 ms per connection measured on a Mac.
Testing
- New cases in
LoopbackTunnel.test.ts stand in for lsof and check that on macOS a client is served only when it is listed as this user's, and that on Windows a client is served with no lookup run. A new Linux case covers a missing row with no user id. The macOS and Linux cases fail without the change.
- macOS:
vp test run src/preview/LoopbackTunnel.test.ts in apps/desktop passed on a Mac, where the existing tests use the real lsof, and its output matched what the parser expects.
- Linux: the test file passes and
vp run check:changed passes. The final revision of this branch was not re-run on macOS or Windows.
- The existing test for a forward's connection limit now handles the reset of the connection it expects to be closed, which made the test command exit non-zero on macOS with all tests passing.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…macOS
The loopback tunnel's SOCKS listener and forwarded ports serve only
connections the system attributes to the current OS user. Linux reads
that from /proc/net/tcp; macOS now reads it from lsof. A connection
whose owner cannot be read is refused on both. Windows is unchanged
and has no owner check.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
juliusmarminge
changed the title
fix(desktop): preview tunnel listeners check the connection owner on macOS and Windows
fix(desktop): preview tunnel listeners check the connection owner on macOS
Nov 24, 2026
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:M
30-99 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.