Engine reference — generated from the canonical engineering source. Do not edit this page by hand.
Network Egress — Luna Sandbox Posture
This page states what Luna’s sandbox actually enforces for network egress, and
what it does not. The decision record with the measured spike is
plan/egress-control-evaluation.md.
The tracked residual row is in
docs/known-security-gaps.md.
Bottom line: the default is a kernel-enforced all-or-nothing network namespace. There is no domain-scoped egress boundary. When an operator enables egress, a compromised tool process can reach any address it can route to (raw IPs included). The domain allow/deny lists are advisory for the in-process web path (and, on macOS, a host-name override for spawned children); on Linux a configured policy simply disables child egress. Neither is a packet filter.
Configuration matrix
The sandbox keys are execution.sandbox.* (client/core/sandbox.lua,
client/core/config.lua):
| Configuration | bwrap argv | Effective egress |
|---|---|---|
network = false (default) | --unshare-net | none — private netns, kernel-enforced |
network = true, no network_policy | no --unshare-net | full host egress |
network_policy = {... } (any truthy value) | --unshare-net | none — the policy’s presence isolates the child; the allowlist is not an egress gate |
bwrap = "off" (any network value) | no bwrap | no network isolation (Landlock is write-only) |
On macOS the seatbelt profile emits (deny network*) when network is disabled
and, with network = true plus a policy, only host-name deny rows
((deny network* (host <domain>))) for the policy’s deny list. The allowlist
is not enforced there either.
MCP stdio servers under execution.sandbox.mcp_stdio_containment use the same
network decision as the shell builder.
What network_policy means
execution.sandbox.network_policy is a table with mode = "allowlist" | "open", allow = {...}, deny = {...} (client/core/network_policy.lua).
It has two consumers, with different semantics:
- Spawned tool children — the presence of the key adds
--unshare-net. The staged/etc/hostsfile still exists, but the namespace has no external interface to resolve or route over, so the policy cannot authorize egress. On Linux bwrap there is currently no way to combine a domain allowlist with child egress. - In-process web tools —
network_allowed/1andhost_allowed_by_policy/3(client/core/web_fetch_shared.lua) check the URL hostname against the allow/deny globs before the request. The fetch transport validates private addresses and pins the resolved addresses (CURLOPT_RESOLVE), and deliberately bypasses proxy environment variables (CURLOPT_NOPROXY="*") so a proxy cannot void the pin.
Bypass class (accepted residual)
When child egress is enabled (Linux: network=true without a policy; macOS:
network=true), the domain policy does not stop these, and this page does not
claim otherwise:
IP literals — a child can connect straight to an address. Deny globs
match names, not destinations. In-process web tools reject private/link-local
literals but not public ones as a policy decision.
DNS answer substitution / rebinding — a spawned child has no per-connect
address pin and no private-address guard; an allowed name can resolve to an
internal address. The in-process web path is stronger (private-IP checks +
per-hop address pins), but that is a separate transport control.
IPv6 / AAAA — the hosts-file deny emits only 0.0.0.0 <domain>, with no
:: entry. AAAA resolution still reaches DNS. The spike in the decision
record observed real AAAA answers and a successful curl -6 resolution
under an IPv4 hosts deny.
Direct-connect libraries, custom resolvers, DoH/DoT, QUIC/UDP — a
process can ignore /etc/hosts, HTTP proxy variables, and the policy module
entirely.
0.0.0.0 is not a blackhole — on Linux, connecting to 0.0.0.0
reaches loopback. A “denied” name can therefore reach a local service on the
same port (measured).
Environment confinement is not an egress control either: --clearenv plus the
ENV_ALLOWLIST (client/core/sandbox.lua) does not forward proxy variables,
and forwarding them would still be advisory.
Operator guidance
Keep execution.sandbox.network = false unless the task genuinely needs
the network. That posture is the only one with a real egress boundary.
Do not treat a configured network_policy.deny list as a firewall. If a
host-level guarantee is required, enforce it outside Luna (host firewall,
egress gateway, or a dedicated network segment); none of those are
per-task domain policies.
bwrap = "off" (or a zero-layer posture) removes network isolation
entirely. The sandbox layer matrix in docs/security.md documents the
general posture; this page covers the egress specifics.
Provider credential variables are scrubbed from the child environment by the
env allowlist/sanitizer; that reduces the value of an egress channel but is
not a substitute for network control.
Status
Accepted risk. No enforcement leg was landed. A proxy-env + private-CA design was rejected as enforcement (advisory, conflicts with the SSRF pin, adds a CA asset, no raw-IP coverage). An nftables/cgroup-netns design is the right future family but requires host provisioning and an IP/DNS policy story. The decision record carries the owner, review date, and revisit triggers.