Get release news

Limit where an AI agent can send data: egress allowlists

An agent that reads untrusted text can be told to send what it knows somewhere else. The reliable control is not the model's judgement but the network: a proxy that checks each connection it receives against a list the agent cannot change.

On this page

Note

Release status

The current source and its signed releases aren't public yet. More in Project status.

What you'll getLink to this section

  • A sandbox that reaches the internet through a proxy that checks each connection it receives against allowed_hosts. Through the proxy, it reaches only the hosts you list. On Docker, the agent's network has no route out, and your host has no address on it. Whether DNS lookups can leave through Docker's own resolver is untested. On Firecracker, the host drops everything but the proxy and its gates.
  • Refusals for the usual detours: undeclared names, raw IP addresses, names that resolve to internal or metadata addresses, other ports.
  • Requests the proxy receives, allowed or refused, become network_allowed or network_blocked audit events when the run ends, so a refused exfiltration attempt is something you can find afterwards. The run's last moments can be missing.

The ideaLink to this section

Exfiltration needs a destination. If the proxy admits only the destinations you listed, an injected instruction to send a file through it to attacker.example is refused there, whatever the model decides, and the refusal is written to the log. The list lives in the Agentfile, which the runtime reads once before the sandbox starts. Nothing the agent sends to the proxy changes it. How the topology is built on each backend: Network isolation.

1. List only the hosts the agent needsLink to this section

agent.yamlyaml
sandbox:
  network:
    allowed_hosts:
      - api.groq.com          # the model API this agent calls

Start from the smallest list that lets the agent do its job: usually its model API and nothing else. An empty or absent list admits no host at the proxy. Constle's own gates stay reachable. On Docker, Docker's own resolver stays reachable too: the agent uses it to find the proxy (see DNS below). Entries are plain lowercase hostnames, and a leading . admits a domain and every subdomain under it.

Be careful with a leading . on a shared domain. An entry for a hosting or storage domain where anyone can create a subdomain admits every customer's subdomain, including one an attacker controls.

2. Leave MCP servers and peers out of the listLink to this section

yaml
mcp:
  servers:
    - id: docs-search
      url: https://mcp.search.internal/mcp     # host side only; never passed into the sandbox
      tools: [search]

Declare MCP servers under mcp.servers and agent-to-agent peers under a2a.peers, not in allowed_hosts. MCP servers are then reached through the MCP gate, where tool allowlists, approvals and metering apply to calls that pass through the gate. Peers are reached through the A2A gate, which signs every message. An Agentfile that lists a declared server's or peer's host in allowed_hosts is rejected at validate time, because that entry would let the agent skip the gate. Only names are compared, so another name for the same server isn't caught (limitation 2). More in MCP tool allowlists.

3. Validate the listLink to this section

shell
constle validate agent.yaml

A scheme, port, path, wildcard, uppercase letter or non-ASCII name in allowed_hosts is a validation error, as is localhost, 127.0.0.1 or host.docker.internal when MCP servers or A2A peers are declared. sandbox.network.egress is not a substitute: it is warned about and ignored (limitation 3).

4. Run, and read what was refusedLink to this section

shell
constle run agent.yaml
grep network ~/.constle/logs/<agent>-$(date -u +%F).jsonl

An agent with allowed_hosts: [api.groq.com] reaching for one declared host and one undeclared one, from the repository's own example (abridged: the log lines show only event and details, while real entries also carry timestamp, run_id and agent_name, plus did, prev_hash and sig when signed):

Output
  ┌─ agent output ──────────────────────────
  │ https://api.groq.com/        CONNECT allowed   TLS tunnel opened, server replied
  │ https://evil.example.com/    CONNECT refused   Tunnel connection failed: 403 Forbidden
  └─────────────────────────────────────────

{"event":"network_allowed","details":{"bytes":5314,"host":"api.groq.com","http_status":200,"method":"CONNECT"}}
{"event":"network_blocked","details":{"bytes":3404,"host":"evil.example.com","http_status":403,"method":"CONNECT"}}

The network events are written when the run ends, from the proxy's own log, so in the file they come after the run's last event (run_finished on a clean exit). Requests from the run's final moments can be missing (limitation 6). With identity.did set, they are signed and chained like every other entry (Verify an AI agent's audit log).

The channels this closesLink to this section

Attempt Result
HTTPS to an undeclared host CONNECT refused with 403 · network_blocked
The raw IP of a declared host, or any IP literal not listed Refused: matching is by name, with reverse lookups off.
An address whose PTR record names a declared host Refused, for the same reason.
A declared name that resolves to loopback, link-local, a cloud metadata address, a private or CGNAT range Refused on the resolved address, whatever DNS answered.
A tunnel to a declared host on port 22, 5432 or anything but 443 Refused: a CONNECT may name 443 only, a plain request 80 or 443.
Dialling out directly, with the proxy variables cleared On Docker, Network is unreachable: the agent's network has no route out, and your host has no address on it. On Firecracker, an IPv4 dial is dropped at the host, and IPv6 has no route in the guest.
Encoding data in names sent to the proxy A refused name is refused before the proxy resolves it. Names under an allowed .domain are resolved, so data encoded in them reaches that domain's DNS.
An MCP server or peer that is not declared, on a host that is not allowed Refused at the proxy, like any host you didn't list.

The channels it leaves openLink to this section

An allowlist decides where data can go, not what is in it. Size these honestly:

  • DNS from a Docker sandbox is untested. Whether the agent's own lookups can leave through Docker's resolver is untested. On Firecracker they are dropped at the host.
  • Traffic to hosts you allow isn't gated. If an allowed host shares a server with an MCP server, a request can reach that MCP server past the gate (limitation 2). The same tunnel can carry a request for any other name that server answers for, such as a CDN or a shared host.
  • Every allowed host is a channel. The agent can put anything it can read into a request to a host you allowed. A model API receives the prompts the agent sends, and a code host you allowed receives what the agent pushes.
  • Declared MCP tools are channels. A tool's arguments go to its server. Tool allowlists and human approval narrow which calls that pass through the gate go ahead, but no rule checks their arguments.
  • DNS is trusted for public addresses. If a declared name resolves to a public address an attacker controls, the proxy lets it through. What DNS cannot do is aim a declared name inside: those destinations are refused on the resolved address.
  • Declared credentials are inside. The variables named under credentials are readable by the agent, and can be sent to any allowed host.
  • What it sends to allowed hosts isn't inspected. Constle never decrypts the agent's HTTPS, so it cannot apply per-path rules or look for secrets in a request body. That is a deliberate trade-off (What Constle is not).
  • One list per agent. Through the proxy, every process inside the sandbox reaches the same allowed hosts.

FAQLink to this section

Can a prompt injection change the allowlist?Link to this section

No. The allowlist is read from the Agentfile before the sandbox starts and enforced by a proxy in the host's control. Nothing the agent can send changes it, and nothing inside the sandbox can change it.

Does the agent need DNS to reach an allowed host?Link to this section

Not for the host itself. A proxy-aware HTTP client sends the hostname to the proxy, which resolves it. On Docker, the agent finds the proxy by its name, squid, through Docker's own resolver. On Firecracker, DNS from the guest is dropped at the host.

Can I allow a host on a port other than 443?Link to this section

Not through the allowlist. A CONNECT tunnel may name port 443 only, and a plain request port 80 or 443, so an allowed name cannot become a raw TCP path to an SSH or database port.

How do I find out the agent tried something it shouldn't?Link to this section

A connection the proxy refuses during the run becomes a network_blocked event with the host it tried, in the run's audit log. With an identity declared, the log is signed and hash-chained, and constle audit verify names any line that was changed afterwards.