Repository navigation
Conversation
This was referenced Oct 14, 2026
chruffins
added this pull request to stack #515
October 14, 2026 17:10
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default 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 23c6890. Configure here.
chruffins
marked this pull request as ready for review
October 14, 2026 19:12
chruffins
force-pushed
the
feat/macos-guest-ports
branch
from
October 14, 2026 20:10
23c6890 to
837ba07
Compare
chruffins
force-pushed
the
feat/macos-guest-ports
branch
2 times, most recently
from
October 15, 2026 16:40
8e6d7c8 to
8385500
Compare
chruffins
force-pushed
the
feat/macos-guest-ports
branch
from
October 15, 2026 19:26
8385500 to
62cae75
Compare
chruffins
force-pushed
the
feat/macos-guest-ports
branch
from
October 15, 2026 22:56
62cae75 to
ca64689
Compare
chruffins
force-pushed
the
feat/macos-guest-ports
branch
3 times, most recently
from
October 19, 2026 17:24
a18ab32 to
6e48e3e
Compare
chruffins
force-pushed
the
feat/macos-guest-ports
branch
from
October 19, 2026 18:01
6e48e3e to
802a888
Compare
chruffins
force-pushed
the
feat/macos-guest-ports
branch
2 times, most recently
from
October 20, 2026 19:33
4861a6c to
8a799f6
Compare
chruffins
force-pushed
the
feat/macos-guest-ports
branch
from
October 20, 2026 20:29
8a799f6 to
22b13e3
Compare
Forward HTTP and WebSocket requests from /instances/{id}/ports/{port}/* to a TCP
port on a macOS guest's loopback interface, through the guest agent on vsock 2223.
Hypeman does not start or supervise services in the guest; the image does.
chruffins
force-pushed
the
feat/macos-guest-ports
branch
from
October 20, 2026 20:32
22b13e3 to
82a8e04
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
PR 5 of 6. Guest-port forwarding for macOS guests. Base: #506. Replaces #501: GitHub marked #501 merged into the builds branch when builds moved to the top of the stack. Nothing from it reached
main.GET|HEAD|POST|PUT|PATCH|DELETE /instances/{id}/ports/{port}/*forwards HTTP and WebSocket requests to127.0.0.1:{port}inside a running macOS guest. It requiresinstance:write, the same scope as exec.Hostis rewritten to127.0.0.1:{port}, because Chrome DevTools rejects other hosts.Authorizationis removed. Responses come back unchanged; rewriting URLs such aswebSocketDebuggerUrlis the caller's job (metro-api, as for Linux).Linux code touched
cmd/api/main.go: exec, cp and port forwarding now share one middleware chain (previously exec and cp each repeated it).lib/scopes: the route and its methods, defined once.lib/system/guest_agent/main.go: starts the forwarder on Darwin only.Testing
-racecover the handshake, the agent forwarder (saturation, slot reuse, transient accept errors) and the API handler: path and escaping, Host and Authorization handling, a WebSocket round trip, and each error status.Review focus
The security boundary: an
instance:writetoken can reach any loopback port in the guest. That's deliberate, since the same token can already exec as root.Stack
Each PR is one commit on the one below it. macOS logic lives in its own files (
macos*.go,*_darwin.go,exec_lifecycle.go,port_forward.go); shared Linux files get small hooks such asif stored.MacOS != nil.Note
Medium Risk
Introduces a new authenticated tunnel to arbitrary guest loopback ports (same privilege model as exec); misconfiguration or compromised
instance:writetokens could expose internal guest services.Overview
Adds
/instances/{id}/ports/{port}/*so clients withinstance:writecan reach HTTP and WebSocket services on a running macOS guest’s127.0.0.1:{port}(ingress replacement for vmnet NAT guests). The handler is anhttputil.ReverseProxyoverguest.DialPort(vsock 2223): path/query pass through,Hostbecomes loopback,Authorizationis stripped, and there is no response timeout for long polls.On Darwin, the guest agent listens on vsock 2223, runs a port handshake, dials loopback, and copies bytes both ways with a 64-connection cap and bounded handshakes.
lib/guestimplements the host-side dial;GuestOpPortForwardreturns 501 for Linux or images without the agent. Exec, cp, and port forward share one middleware chain; route constants live inlib/scopes.Reviewed by Cursor Bugbot for commit 23c6890. Configure here.