Skip to content

fix(ext/fetch): require --allow-net for Unix proxy in createHttpClient - #35231

Merged
bartlomieju merged 2 commits into
mainfrom
fix/fetch-unix-proxy-allow-net
Jun 15, 2026
Merged

bartlomieju merged 2 commits into
mainfrom
fix/fetch-unix-proxy-allow-net

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

PR #34395 added a Unix-domain-socket network boundary: Unix socket endpoints
are represented as --allow-net=unix:<absolute-path>, and the direct Unix
socket ops (Deno.connect, Deno.listen, Deno.listenDatagram, and
DatagramConn.send) now require that grant in addition to the existing
filesystem check on the socket path.

Deno.createHttpClient({ proxy: { transport: "unix", path } }) is a sibling
Unix-socket transport that the original change did not cover. The Proxy::Unix
branch in op_fetch_custom_client only performed the filesystem check_open
on the socket path and never called check_net_unix_socket, so a custom client
could route fetch() traffic to a local Unix socket with filesystem access
alone, without an --allow-net=unix:<path> grant. The two neighboring branches
in the same match already do the right thing: Proxy::Tcp calls check_net
and Proxy::Vsock calls check_net_vsock.

This makes the Unix proxy connector consistent with its siblings and with the
direct Unix socket ops: after resolving the socket path with check_open, it
now also calls check_net_unix_socket before storing the normalized path.

Added regression tests covering a Unix-proxy createHttpClient denied with
read/write but no --allow-net=unix:<path>, denial when the scoped rule names
a different socket path, and success when the rule matches the exact path. The
existing fetchUnixSocket test continues to exercise the allowed path under
unscoped --allow-net.

Deno.createHttpClient with a Unix-socket proxy transport checked only
filesystem access to the socket path. It now also requires an
--allow-net=unix:<path> rule, matching the direct Unix socket ops and the
Tcp/Vsock proxy branches.
@bartlomieju
bartlomieju enabled auto-merge (squash) June 15, 2026 11:49
The fetchUnixProxyScopedAllowNetGrantsAccess subprocess fetches
http://localhost/, which performs the normal net check on the request
URL host (localhost:80) independently of the Unix proxy grant. Add
localhost to the --allow-net rule so the request is permitted.
@bartlomieju
bartlomieju merged commit 75094e8 into main Jun 15, 2026
267 of 270 checks passed
@bartlomieju
bartlomieju deleted the fix/fetch-unix-proxy-allow-net branch June 15, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant