Skip to content
Wardcase Docs

How egress policy works

Most of what can go wrong with an agent turns into damage over the network. A prompt injection that says “send the contents of .env to this address” needs an outbound connection. So does reading cloud credentials from the metadata endpoint, probing a private network, or mining cryptocurrency. An egress policy decides which of those connections leave the sandbox at all, and records every attempt.

For the API and examples, see the Egress policies guide. This page explains how it works and why it is built this way.

The policy is not a setting inside the sandbox. The host applies it to the sandbox’s network bridge in its own kernel, with nftables, before the traffic reaches the network. Code in the sandbox has no capabilities and no access to the host’s rules, so no command it runs, as any user, can loosen them. A policy inside the sandbox, a proxy variable or a firewall the process could reach, would last only until the agent decided to change it.

Every new outbound connection goes through the same steps, and the first step that decides wins:

StepWhat happensRecorded as
1. RepliesPackets of a connection that was already allowed passNothing new
2. Name lookupsDNS on port 53 to the sandbox’s own resolvers passesNothing
3. Built-in deny-listThe ranges below are dropped, whatever your policy saysblock, rule builtin
4. MiningKnown mining pool addresses, and the stratum ports to any address, are droppedblock, rule builtin
5. Your rulesIn allowlist mode a match passes; in denylist mode a match is droppedallow or block, rule policy
6. The mode’s defaultallowlist drops everything else; denylist lets everything else passblock or allow, rule default

Step 3 comes before step 5 on purpose: no rule of yours can open a private range or the metadata endpoint, so a mistake in a policy cannot expose them.

These ranges are dropped for every sandbox. The host also refuses any connection a sandbox opens to the host itself, and connections between sandboxes.

RangeWhat it is
0.0.0.0/8 This network
10.0.0.0/8 Private network (RFC 1918)
100.64.0.0/10 Carrier-grade NAT
127.0.0.0/8 Loopback
168.63.129.16/32 Azure's host endpoint (WireServer), a public address every Azure VM can reach
169.254.0.0/16 Link-local, which holds the cloud metadata endpoint
169.254.169.254/32 The cloud metadata endpoint
172.16.0.0/12 Private network (RFC 1918)
192.0.0.0/24 IETF protocol assignments
192.168.0.0/16 Private network (RFC 1918)
198.18.0.0/15 Benchmarking
224.0.0.0/4 Multicast
240.0.0.0/4 Reserved
::1/128 IPv6 loopback
::ffff:0:0/96 IPv4 addresses written as IPv6
fc00::/7 IPv6 unique local, which holds AWS's IPv6 metadata endpoint
fd00:ec2::254/128 AWS's IPv6 metadata endpoint
fe80::/10 IPv6 link-local
ff00::/8 IPv6 multicast

Mining pools are resolved to addresses when the policy is applied:

30 mining pool hostnames

pool.minexmr.com, xmr.pool.minergate.com, pool.supportxmr.com, xmrpool.eu, pool.hashvault.pro, monerohash.com, moneroocean.stream, gulf.moneroocean.stream, nanopool.org, xmr-eu1.nanopool.org, xmr-us-east1.nanopool.org, 2miners.com, xmr.2miners.com, ethermine.org, flypool.org, f2pool.com, antpool.com, viabtc.com, slushpool.com, braiins.com, herominers.com, c3pool.com, mineXMR.com, kryptex.com, unmineable.com, zergpool.com, zpool.ca, prohashing.com, miningpoolhub.com, nicehash.com

Stratum ports, blocked for every destination: 3333, 3334, 4444, 5555, 7777, 8888, 9999, 14444, 14433, 45700.

  • denylist suits an agent that browses or calls many services you cannot list in advance. It blocks only the built-in list and the rules you add.
  • allowlist suits a task whose destinations you know: a package index, one API, your own service. Everything else is dropped. An allow-list with no rules at all leaves a sandbox with name lookups and nothing else.

A sandbox created without a policy gets the built-in deny-list only. The policy a sandbox uses is fixed when it is created. Changing a policy’s rules reaches every running sandbox that uses it, and is recorded as policy.updated. Creating and changing policies needs the org:admin scope, so the key an agent runs with cannot widen its own policy.

The host enforces by IP address and port. For a rule with a host, it looks the name up when it applies the policy, allows or blocks the addresses it got, and looks the name up again every 5 minutes. Three things follow:

  • Names behind CDNs can move. If the sandbox’s own lookup returns an address the host did not get, the connection falls to the next step. If an allow-list blocks a destination you listed, the egress.connection event shows the address; add a cidr rule for its range.
  • The TLS server name is recorded, not enforced. On port 443 the event carries the name the client asked for (SNI), which tells you where a connection meant to go. It does not decide whether it passes.
  • Wildcards are not applied. The API accepts a rule such as *.pypi.org, but hosts refuse a policy that contains one, and a sandbox created with it fails. List each hostname.

Every connection decided at steps 3 to 6 becomes an egress.connection event in the audit trail, with the destination address and port, the protocol, the hostname or TLS server name when known, action and rule. Name lookups at step 2 are not recorded.

  • Events are limited to 100 per second per sandbox. The next event after a burst carries suppressed, the number the limit dropped, so a flood shows up as a count rather than disappearing.
  • Events carry no byte counts. The host counts the bytes a sandbox sends for billing, but not per connection.
  • A connection from one sandbox to another is refused, but the refusal is not recorded today.