#[non_exhaustive]pub struct SandboxNetwork {
pub allowed_domains: Option<Vec<String>>,
pub denied_domains: Option<Vec<String>>,
pub allow_managed_domains_only: Option<bool>,
pub allow_unix_sockets: Option<Vec<String>>,
pub allow_all_unix_sockets: Option<bool>,
pub allow_local_binding: Option<bool>,
pub allow_mach_lookup: Option<Vec<String>>,
pub http_proxy_port: Option<u16>,
pub socks_proxy_port: Option<u16>,
pub tls_terminate: Option<TlsTerminate>,
pub strict_allowlist: Option<bool>,
pub extra: Extra,
}Expand description
sandbox.network.
Control which hosts, ports, and sockets sandboxed commands can reach. The sandbox routes outbound traffic through a proxy that enforces these lists; see Network isolation for how the proxy decides and when it prompts.
Docs: sandbox.network.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.allowed_domains: Option<Vec<String>>Pre-allow domains for outbound traffic from sandboxed commands, so the sandbox doesn’t
prompt for them. Wildcards such as *.example.com match subdomains, and an optional
:port suffix limits an entry to one port; an entry without a port matches every port.
- Values: array of strings, each a domain, wildcard pattern, or IP literal, with an
optional
:portsuffix - Default: unset, so your permission mode decides what happens to each new host
- Scope: any settings file, with limits on project and local settings. Only managed settings when allowmanageddomainsonly is set.
Docs: allowedDomains.
denied_domains: Option<Vec<String>>Block domains for outbound traffic from sandboxed commands, using the same wildcard,
port, and IPv6 syntax as
allowedDomains.
A denied domain stays blocked even when an allowedDomains entry matches it too.
- Values: array of strings, each a domain, wildcard pattern, or IP literal, with an
optional
:portsuffix - Default: unset
- Scope: any settings file.
Docs: deniedDomains.
allow_managed_domains_only: Option<bool>Lock the network allowlist to what managed settings define. Claude Code then honors only
allowedDomains and WebFetch(domain:...) allow rules from managed settings, ignores
domains from user, project, local, and --settings settings, and blocks a non-allowed
domain automatically instead of prompting.
- Values: Boolean
true: Claude Code honors onlyallowedDomainsandWebFetch(domain:...)allow rules from managed settings and blocks a non-allowed domain instead of promptingfalse: domains from other settings files can merge into the allowlist
- Default:
false - Scope: managed.
Docs: allowManagedDomainsOnly.
allow_unix_sockets: Option<Vec<String>>List the Unix socket paths sandboxed commands can connect to on macOS. Claude Code
ignores this list on Linux and WSL2, where the seccomp filter can’t inspect socket
paths; use
allowAllUnixSockets
there instead.
- Values: array of strings, each a socket path
- Default: unset, so the macOS sandbox blocks every Unix socket
- Scope: any settings file, with limits on project and local settings.
Docs: allowUnixSockets.
allow_all_unix_sockets: Option<bool>Let sandboxed commands connect to every Unix socket. On Linux and WSL2, the sandbox’s
seccomp filter
blocks socket(AF_UNIX, ...) calls, so this is the only way to permit Unix sockets
there. When the filter is missing, which /sandbox reports on its Dependencies tab, the
sandbox doesn’t block Unix-socket calls.
- Values: Boolean
true: sandboxed commands can connect to every Unix socket. On Linux and WSL2 they can also connect to VM sockets, theAF_VSOCKaddress familyfalse: the sandbox blocks Unix-socket connections: on macOS except the paths inallowUnixSockets, and on Linux and WSL2 through the seccomp filter when it’s present
- Default:
false - Scope: any settings file, with limits on project and local settings.
Docs: allowAllUnixSockets.
allow_local_binding: Option<bool>Let sandboxed commands on macOS listen on network ports, for example to start a dev server, and connect to any port on localhost. A command that listens on a non-loopback address accepts connections from other machines. The key has no effect on Linux and WSL2, where each sandboxed command has its own loopback interface.
- Values: Boolean
true: sandboxed commands on macOS can listen on any local address and connect to any port on localhostfalse: sandboxed commands on macOS can’t listen on a port or connect directly to servers on localhost
- Default:
false - Scope: any settings file, with limits on project and local settings.
Docs: allowLocalBinding.
allow_mach_lookup: Option<Vec<String>>List additional XPC and Mach service names the macOS sandbox may look up. Tools that communicate over XPC, such as the iOS Simulator or Playwright, need their services listed here. Sandboxed commands can reach outside the sandbox to each service that you list, and the sandbox doesn’t confine what those services do for those commands.
- Values: array of strings, each a service name; a single trailing
*matches a prefix, and"*"alone matches every service - Default: unset
- Scope: any settings file, with limits on project and local settings.
Docs: allowMachLookup.
http_proxy_port: Option<u16>Point the sandbox at your own HTTP proxy instead of the one Claude Code runs. Organizations do this to inspect HTTPS traffic, apply their own filtering rules, or log requests. Your proxy takes over filtering, and Claude Code stops applying its domain lists and network prompts to traffic sent there.
- Values: number, a local TCP port
- Default: unset, so Claude Code runs its own proxy
- Scope: any settings file, unless other sandbox settings limit which files can set a port.
Docs: httpProxyPort.
socks_proxy_port: Option<u16>Point the sandbox at your own SOCKS5 proxy instead of the one Claude Code runs. Your proxy takes over filtering, and Claude Code stops applying its domain lists and network prompts to traffic sent there. When unset, Claude Code starts its own proxy for SOCKS traffic.
- Values: number, a local TCP port
- Default: unset, so Claude Code runs its own proxy
- Scope: any settings file, unless other sandbox settings limit which files can set a port.
Docs: socksProxyPort.
tls_terminate: Option<TlsTerminate>Make the sandbox proxy terminate TLS so it can read the contents of HTTPS requests. This
is experimental, and mask credential
substitution requires it.
Set {} to generate an ephemeral certificate authority for the session, or set
caCertPath and caKeyPath to use your own.
- Values: object with optional
caCertPathandcaKeyPathstrings, each a file path - Default: unset, so the proxy doesn’t terminate or inspect TLS
- Scope: user or managed. A repository can’t switch it on or supply a certificate authority.
Docs: tlsTerminate.
strict_allowlist: Option<bool>Deny sandboxed commands access to hosts outside the allowlist instead of prompting for
approval. The allowlist is
allowedDomains
plus domains from WebFetch(domain:...) allow rules, or only the managed settings
entries when
allowManagedDomainsOnly
is set. Locks that apply without an admin-required
sandbox
covers a repository’s entries.
- Values: Boolean
true: Claude Code denies sandboxed commands access to hosts outside the allowlistfalse: unless another trusted settings file setstrue, Claude Code decides a host outside the allowlist by permission mode instead of denying it outright: in auto mode it checks the host against the command’s per-command allowed domains, indontAskmode it denies, inbypassPermissionsmode and in interactive terminal plan-mode sessions where bypass is available it allows, and otherwise it asks you
- Default:
false - Scope: user or managed. A repository can’t turn it on or off.
Docs: strictAllowlist.
extra: ExtraKeys Claude Code accepts here that this crate doesn’t model (newer or undocumented ones), kept as written so the document round-trips.