Commit graph

6 commits

Author SHA1 Message Date
Cameron Mcloughlin
795c44f61d
agent: Sandbox DNS rebinding and redirect cleanup (#60941)
Tidies up the host resolution code a bit and closes some small gaps

---

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-07-14 15:29:30 +00:00
Cameron Mcloughlin
c49a29f461
sandbox: Linux domain filtering and some more cleanup (#59790)
---

Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: MartinYe1234 <martin@zed.dev>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
2026-06-24 01:42:52 +00:00
Richard Feldman
2c0a044237
Make unrestricted sandbox network access explicit (#59385)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / extension_tests (push) Blocked by required conditions
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / miri_scheduler (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
This makes unrestricted sandbox network access an explicit sandbox mode
instead of a fallback when the enforcing proxy is unavailable.
Host-specific network access still uses the proxy, while approved
arbitrary network access skips proxy setup and maps directly to
unrestricted egress.

Release Notes:

- Improved agent terminal sandbox network permission handling.

---------

Co-authored-by: Martin Ye <martin@zed.dev>
Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
2026-06-15 22:40:16 +00:00
Richard Feldman
c8faadd9c8
http_proxy: Add the allowlisting proxy server (#59223)
Third of the `http_proxy` stack. Stacked on #59217 and the
upstream-config PR — review/merge those first.

Adds the in-process HTTP/HTTPS proxy server that enforces an
`Allowlist`. It speaks HTTP CONNECT for HTTPS tunnels and forward
proxying for plain HTTP, vets resolved addresses against
loopback/private/link-local ranges to prevent DNS-rebinding past the
sandbox, pins each connection to the destination approved for its first
request (so later keep-alive requests can't escape the policy decision),
optionally chains through the upstream proxy, and bounds header sizes,
connection counts, and connect/handshake waits since its sole client is
untrusted model-driven code running inside the editor process. Includes
end-to-end tests covering allowed/denied CONNECT and HTTP forward,
IP-literal handling, DNS-rebinding denial, and upstream chaining.

Still has no callers; wired into the agent terminal sandbox in the
remaining PRs of the stack.

Release Notes:

- N/A

---------

Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
2026-06-15 21:17:52 +00:00
Richard Feldman
c52d06a8f3
http_proxy: Add upstream proxy configuration (#59222)
Second of the `http_proxy` stack. Stacked on #59217 — review/merge that
first; this PR's diff is just the upstream-proxy config.

Adds `UpstreamProxy`: parsing of an upstream HTTP proxy from the
environment (`HTTPS_PROXY` / `HTTP_PROXY` / `ALL_PROXY` and lowercase
forms) with `NO_PROXY` bypass matching delegated to the `proxyvars`
crate, basic-auth credentials kept out of `Debug`/`Display`, and
IPv6/default-port normalization. The proxy server (next PR) uses this to
chain outbound connections through a corporate proxy when one is
configured.

Release Notes:

- N/A
2026-06-15 21:00:52 +00:00
Richard Feldman
f73b9daf3b
http_proxy: Add hostname allowlist policy types (#59217)
First of a stack adding hostname-allowlisted network access to agent
terminal sandboxing. Adds a new `http_proxy` crate containing only the
allowlist policy types.

`HostPattern` parses exact hostnames or leading-`*.` subdomain
wildcards, normalizes IDNs to punycode, and rejects IP literals and
localhost-family names. `Allowlist` holds a set of patterns (or an
allow-any escape hatch), and `covers` implements host-pattern
subsumption (`*.github.com` covers `api.github.com`) used later to
decide when an already-granted permission covers a new request — the
network analogue of write-path subtree containment.

Pure, self-contained logic with no callers yet. The upstream-proxy
config and the proxy server that enforces these policies land in the
next two PRs.

Release Notes:

- N/A
2026-06-15 18:48:59 +00:00