Credentials and routes
A route is a host under sandbox.egress.routes whose HTTPS traffic Axocoatl reads
instead of passing it through as an opaque tunnel. For each route host it:
- ends TLS on your computer, with a certificate from an authority created for that Session, and opens its own TLS connection to the real host;
- checks each request’s method, path and query against the route’s rules, and refuses
the rest with a
403that says which rule was missing; - on a route to a model API, reads each request body and refuses one that asks the provider to reach other hosts or run tools itself (see Requests to model APIs);
- adds the route’s credential, read by the daemon at that moment, and removes any credential the client sent itself;
- writes each request to the Session’s network record before it is sent, with the rule that allowed it and the name of the credential used, never its value.
The credential is never written into a container’s environment, files or command
lines, and never passed to the egress proxy container. What the host sends back is
another matter: a token or session the host issues in a response, for example from a
login or /token endpoint the route allows, reaches the container and can be used
without the route; see Responses. Stdio MCP servers run on
your computer and are a separate case; see Define a credential.
Routes need
sandbox.network: egress; see Network egress
for the proxy itself.
The egress proxy answers a CONNECT to a route’s host and port with a relay: it
carries the client’s TLS bytes to the daemon over its control channel and connects
nowhere itself. The daemon resolves the name and checks every address as it does for
allow (a private address needs private_destinations), and connects to the host
from your computer, only to those addresses. On a route’s ports the route decides,
whatever allow lists: a plain-HTTP request to the host gets 403 tls_required,
and a process the route does not serve gets 403 route_not_for_binding. Routes
serve the Session’s own processes; readiness provisioning and the browser’s declared
hosts (browser.allow) keep their own lists and reach their hosts as plain tunnels.
Define a credential
Section titled “Define a credential”credentials: github: {env: GITHUB_TOKEN} registry: {file: ~/.config/axocoatl/credentials/registry}A credential names where the daemon reads its value, never the value:
envnames an environment variable of the daemon. When Axocoatl runs as a service, set it where the service starts, not in your shell. A stdio MCP server inherits the daemon’s whole environment unless it setsinherit_env: false, so it gets this variable too, and any of its tools that reports its environment can hand the value to an Agent. Preferfile, or setinherit_env: falseon every stdio MCP server; validation warns about each one that inheritsenvcredentials.filenames a file outside every Workspace, by absolute path or~/.... It must be a regular file (not a symbolic link), owned by the daemon’s user and readable only by it (chmod 600). One trailing line break is ignored; any other line break or control character refuses the credential.
The value is read each time a request needs it, so replacing the file or restarting
the service with a new variable rotates it. If it cannot be read, requests on its
routes get 503 credential_unavailable. ${...} is not substituted inside
credentials or sandbox.egress.routes: validation refuses it there, before
substitution, because it would copy the value into the config. A plain value in
place of {env: ...} or {file: ...} is refused without repeating it.
axocoatl doctor lists each credential and whether its variable is set (in the shell
that runs doctor) or its file is owner-only, without reading or printing a value.
Add a route
Section titled “Add a route”sandbox: network: egress egress: allow: [npm] routes: - host: github.com ports: [443] credential: github inject: {basic: {username: x-access-token}} for: [agent, terminal] rules: - {methods: [GET], path: "/acme/app.git/info/refs", query: {service: git-receive-pack}} - {methods: [POST], path: "/acme/app.git/git-receive-pack"} - host: registry.npmjs.org # rules only, no credential access: read-only| Field | Default | Meaning |
|---|---|---|
host | required | One exact host name. No wildcard and no IP address. |
ports | [443] | Ports the route covers. |
credential | none | A credentials name, added to every allowed request. |
inject | required with credential | {basic: {username: NAME}} sends Authorization: Basic base64(NAME:credential); {header: NAME, format: "Bearer {}"} sends that header with {} replaced by the credential (format defaults to "{}"). |
for | [agent] | Which kinds of process may use the route: agent (Agents’ bash commands), terminal, setup. Others get 403 route_not_for_binding. It checks the kind of proxy credential a process presents, not who controls the process; see Who for keeps out. |
rules | The requests the route allows. | |
access | A preset in place of rules: read-only (GET, HEAD, OPTIONS on every path) or full (every method on every path). | |
upstream_ca | none | A PEM file with the certificate authority of a private host, trusted for this route in addition to your computer’s own trust settings. Owner-only, outside every Workspace. |
env_placeholders | [] | Variables set to axocoatl-route:<host> in the environments of the processes the route serves, for tools that refuse to start without a token of their own. The route removes whatever the client sends in place of its credential. |
allow_encoded_responses | false | Pass compressed responses on a credentialed route (see Responses). |
allow_set_cookie | false | Pass Set-Cookie and Set-Cookie2 on a credentialed route, which otherwise removes them (see Responses). |
max_request_bytes | 1 GiB | Largest request body; a larger one gets 413. |
provider_fetch | refuse on a model API host, unset elsewhere | refuse reads each request body and refuses one that asks the model provider to reach other hosts or run tools itself; allow sends bodies unread. See Requests to model APIs. |
A host listed both under allow (or in a preset) and under routes is handled by
the route on the route’s ports; validation warns about it. Up to 64 routes, 64 rules
each.
axocoatl network reload applies changes to routes and credentials to running
Sessions: each records its new policy, which lists every route, a route that
changed in any way closes the connections it was serving, and a new route closes the
plain tunnels already open to its host on its ports. See
Reload the network allowlists.
Who for keeps out
Section titled “Who for keeps out”for tells processes apart by the kind of proxy credential they present: an Agent’s
bash command, a terminal you open, or a setup command. It does not tell who wrote
the code a process runs. Agents’ commands, terminals and setup commands all run as
the same user (the writer, with workload users), with the same home directory and
Workspace. An Agent can leave code that a terminal or setup step runs later with its
own credential, such as a line in ~/.bashrc, a Git hook in .git/hooks or an npm
script, and so use a for: [terminal] or for: [setup] route within its rules. With
sandbox.workload.mode: image, an Agent’s command can also read a running terminal’s
credential from /proc. If Agents must never use a credential, do not configure a
route for it; push from your own computer instead.
Each rule lists uppercase methods, a path and, optionally, query parameters.
Methods are case-sensitive: get is not GET, and HEAD is not implied by GET.
A path is matched segment by segment. * matches exactly one non-empty segment and
** any number of segments, including none; each must be a whole segment
(/repos/*/issues, /v2/**), never part of one. A trailing / is a segment of its
own, so /a/b/ and /a/b are different paths. Escapes such as %3A match in either
case.
Each query parameter must appear exactly once in the request with that value after
decoding, or * for any value. Other parameters are allowed. A request that repeats
a required parameter does not match, so a server that reads the last copy cannot be
given a different one. Some servers also split parameters on ;, so a query with a
raw ; matches no rule that requires a parameter (%3B is fine).
Before any rule sees it, a request’s path must be canonical. Axocoatl answers 400 path_not_canonical to a path with a . or .. segment, //, a \, an escaped /,
\ or . (%2F, %5C, %2E) or one escaped twice (%252F), an escaped control
character, a malformed escape, or a byte that is not printable ASCII. Servlet
containers such as Tomcat drop a path parameter (; to the end of the segment)
before they read dot segments, so a segment whose part before the first ; is .,
.. or empty (..;, .;x, ;x) is refused as well; name;v=1 is fine. A server
could otherwise read such a path as another one.
Validation warns when a credentialed route allows every path (a rule whose path
starts with **, access: read-only or access: full): the credential is then
added to any request on that host that the route allows, including a login or token
endpoint whose response hands the container a credential of its own.
What the client sees
Section titled “What the client sees”TLS for a route host ends in the daemon, so the client must trust the Session’s
authority. When a Session has routes as its runtime starts, its containers get it at
/etc/axocoatl/ca, from a read-only volume (axo-ca-<session>; a Ways attempt’s
container mounts its Session’s):
bundle.pem: your computer’s trusted roots followed by the Session’s authority. It is set inSSL_CERT_FILE,CURL_CA_BUNDLE,REQUESTS_CA_BUNDLE,PIP_CERT,GIT_SSL_CAINFOandCARGO_HTTP_CAINFO, so hosts reached through ordinaryallowtunnels still verify as before.session-ca.pem: the Session’s authority alone, inNODE_EXTRA_CA_CERTSandDENO_CERT, which add it to those runtimes’ own roots.
These variables are set only for processes of a kind some route serves (see for),
in the same environment file as their proxy credential. A Session whose runtime
started without routes, for example one that got its first route from a reload, has
no trust files: its clients refuse the route’s certificates until the runtime starts
again.
The authority is an ECDSA P-256 key made in the daemon’s memory when a Session first
has routes, valid for 30 days; its key is never written anywhere. A runtime start
replaces an authority with less than two days left, and a daemon restart makes a new
one, which Sessions get when their runtime starts again. It issues a 24-hour
certificate per route host. A tool that pins certificates, or keeps its own trust
store that none of these variables reach, fails on a route host; list the host
under allow instead of routes to keep it a plain tunnel.
The TLS server name the client sends and each request’s Host header must both be
the route’s host, so a route cannot be used to reach other sites on the same CDN or
address. A request with a header that servers read as its method, path or host in
place of the request itself (X-HTTP-Method-Override, X-HTTP-Method,
X-Method-Override, X-Original-Method, X-Original-URL, X-Original-URI,
X-Rewrite-URL, X-Original-Host, X-Host, Forwarded or any X-Forwarded-*) is
refused with 403 override_header, also when the name is written with _ in place of
- (X_HTTP_Method_Override, X_Forwarded_Host), which servers such as WEBrick,
Werkzeug’s development server, PHP’s built-in server and, when only that form is
sent, Puma read as the same header. Only HTTP/1.1 is offered. WebSocket, HTTP/2 and
other upgrades, and CONNECT inside a route, are refused with
403 upgrade_not_allowed.
A refused request gets a JSON answer and an X-Axocoatl-Egress header:
HTTP/1.1 403 ForbiddenContent-Type: application/jsonX-Axocoatl-Egress: denied; reason=route_denied
{"error":"route_denied","reason":"no rule of route#0 (github.com) allows DELETE /acme/app.git", "host":"github.com","method":"DELETE","path":"/acme/app.git", "hint":"Add a rule to sandbox.egress.routes[0] such as {methods: [DELETE], path: \"/acme/app.git\"}, then run axocoatl network reload."}The hint names the place to change the route. For a route of a
loadout Session that the loadout added, it names the loadout’s
route instead of sandbox.egress.routes, and for the route Axocoatl adds for an
external writer it says so.
| Status | error | When |
|---|---|---|
403 | route_denied | No rule allows the request. |
421 | host_mismatch | Host is not the route’s host. |
400 | path_not_canonical | The path is not canonical. |
403 | upgrade_not_allowed | An upgrade, CONNECT or HTTP/2 was asked for. |
403 | override_header | A header names another method, path or host. |
403 | tls_required | A plain-HTTP request to a route’s host and port (answered by the egress proxy). |
403 | route_not_for_binding | The process kind is not in the route’s for, or is unknown (answered by the egress proxy). |
403 | provider_fetch_refused | The body asks the model provider to reach other hosts or run tools itself, or the route cannot read it (see Requests to model APIs). |
403 | ai_sdk_gateway_refused | On a route to ai-gateway.vercel.sh that checks bodies, a body in the AI SDK’s own gateway protocol (/v<N>/ai/…), which the route cannot read; the hint names the gateway’s OpenAI-compatible API. |
413 | request_too_large | The body is larger than max_request_bytes, or, on a route that checks bodies, larger than 64 MiB. |
400, 408 | request_incomplete | On a route that checks bodies, the body ended early or did not arrive within 5 minutes. Nothing was sent. |
503 | credential_unavailable | The credential’s variable or file cannot be read. |
403, 502 | ollama_cloud_not_off | On the route to Ollama on this computer (sandbox.egress.host_ollama), Ollama did not report its cloud features off when asked just before the request (502 when it did not answer). Nothing was sent. |
503 | record_unavailable | The request could not be written to the network record. |
502 | upstream_failed | The host could not be reached or failed; 504 when it did not answer in time. |
502 | encoded_response | A credentialed route got a compressed response. |
502 | credential_reflected | The response’s status line or headers carried the credential. |
Requests going out
Section titled “Requests going out”For an allowed request Axocoatl removes Authorization, Proxy-Authorization and
the route’s own header from what the client sent, adds the credential, and sets
Host to the route’s host. On a credentialed route it also asks for an uncompressed
response (Accept-Encoding: identity) and drops Range and If-Range, so every
response it checks is whole. The route’s header, Accept-Encoding and If-Range are
also removed when the client writes them with _ in place of -. Connection headers
such as Connection, Upgrade and Expect are not forwarded. Bodies are streamed both ways,
except that a route that checks bodies (Requests to model APIs)
reads a request body whole before it sends it. Requests with method, URL
or host override headers never get this far (see
What the client sees). A method override carried in the
query or body, such as the _method parameter some frameworks read, is not looked
at.
The connection to the host goes only to the addresses Axocoatl already resolved and
checked for that connection, never to this computer’s own addresses. Its certificate
is checked with your computer’s trust settings, plus upstream_ca when the route
sets it.
Requests to model APIs
Section titled “Requests to model APIs”A route to api.anthropic.com, api.openai.com, chatgpt.com, openrouter.ai,
generativelanguage.googleapis.com, api.mistral.ai, api.x.ai or
ai-gateway.vercel.sh reads each request body before it adds the
credential or records the request as allowed, and refuses one that asks the model
provider to reach other hosts or to run tools itself. Without that, a request the
route’s rules allow could ask the provider to fetch a URL, search the web or connect to
an MCP server, and the provider would reach hosts the Session’s egress policy does not
list, with whatever the request put in the URL or the search, and send back what it
found. The routes Axocoatl adds for external writers
are such routes. Any other route checks bodies the same way when it sets
provider_fetch: refuse, for example a gateway that serves one of these APIs under
another name. provider_fetch: allow turns the check off for one route to a model
API, and validation warns about it. The Session’s policy records the setting of every
route to a model API and of every route that sets it.
The route reads the body whole, at most its max_request_bytes and at most 64 MiB
(a larger one gets 413 request_too_large), and checks it by the request format of
the endpoint its path names:
| Path ends with | Request format |
|---|---|
/messages, /messages/count_tokens | Anthropic Messages |
/responses, /responses/compact, /responses/input_tokens | OpenAI Responses, also the ChatGPT backend’s /backend-api/codex/responses |
/chat/completions, /completions | Chat Completions: OpenAI, OpenRouter, Gemini’s OpenAI-compatible API, Mistral (also /v1/fim/completions), xAI, the Vercel AI Gateway |
/models/<model>:generateContent, :streamGenerateContent, :countTokens | Gemini |
It refuses a body that holds any of these:
- A tool the provider runs. Tools pass by their type, and only types the client
runs pass: Anthropic custom tools (no
type, orcustom) andbash_,text_editor_,computer_andmemory_tools with a date; OpenAIfunction,custom,local_shell,apply_patch,shellwithout a hosted environment andtool_searchwithexecution: "client", and anamespace(a named group of tools, as Codex sends them forgpt-6.1-solandgpt-6-luna) whose tools all pass; Chat Completionsfunctionandcustom; Gemini tools with onlyfunctionDeclarations. Every other type is refused, such asweb_search_*,web_fetch_*,code_execution_*andmcp_toolset(Anthropic),web_search,file_search,code_interpreter,image_generation,computer_use_previewandmcp(OpenAI),googleSearch,urlContextandcodeExecution(Gemini),x_searchandcode_execution(xAI),image_generation,document_library,connectorandweb_search_premium(Mistral), the Vercel AI Gateway’svercel:perplexity_search,vercel:exa_search,vercel:parallel_search,vercel:tako_search,vercel:browserbase_searchandvercel:browserbase_fetch, and any type Axocoatl does not know. - A server the provider connects to, or a search it runs: an
mcp_serverslist that is not empty, an OpenRouterpluginsentry that is notenabled: false,web_search_options, and xAI Live Search (search_parameterswith amodeother thanoff; xAI’s default ison). - Options the provider receives untranslated: a Vercel AI Gateway
providerOptionsentry other thangateway, which the gateway passes through to the provider (providerOptions.anthropic,.openai,.google, …), where some turn on its own search or grounding. The gateway’s own routing, fallback and caching options pass. - Content the provider fetches from a URL: an Anthropic content
sourceof typeurl, or of any type butbase64,text,contentandfile; animage_url,video_url,audio_urlordocument_urlthat is not adata:URL; anyfile_url; afile_datathat is a URL; aninput_audiothat holds a URL (Mistral fetches one); a GeminifileData.fileUrioutsidehttps://generativelanguage.googleapis.com/. Mistral fetches adocument_urland animage_urlfrom their public URLs; OpenAI, OpenRouter and xAI fetch image URLs. - A model that searches the web by itself, in
modelormodels: an OpenRouter:onlinemodel, OpenAI models whose name containssearch-preview,search-apiordeep-research,perplexity/models (OpenRouter and the Vercel AI Gateway), and models of the search and fetch providers the Vercel AI Gateway lists (exa/,parallel/,tako/,browserbase/). - An OpenAI stored prompt (
promptwith anid), which can bring tools and inputs the request does not show.
They are looked for anywhere in the body (messages, system prompt, tool results,
earlier turns), except in JSON schemas, metadata and the arguments the model gave a
tool call, which the provider does not act on. A body the check cannot read is refused
too: one that is not JSON, that repeats a key in one object (parsers differ on which
copy counts), that nests more than 512 levels deep, that is compressed
(Content-Encoding), or that goes to an endpoint not in the table above, such as a
file upload, a batch, embeddings or Mistral’s OCR. A body in the AI SDK’s own protocol
to the Vercel AI Gateway (/v<N>/ai/… on ai-gateway.vercel.sh, what gateway() of
the ai package sends) is refused with its own reason, ai_sdk_gateway_refused, and a
hint that names the gateway’s OpenAI-compatible API, which the route reads
(The e2e check shows the client).
A body to any agents or conversations endpoint is refused as well: Mistral’s run
the built-in tools and connectors of an agent stored with Mistral, which a request
names only by its agent_id. Set provider_fetch: allow on a route that needs those.
A request without a body passes.
A refused request reaches nothing. It is recorded with the reason
provider_fetch_refused, the connection stays open, and the answer names what was
refused and where, never a value from the body:
HTTP/1.1 403 ForbiddenContent-Type: application/jsonX-Axocoatl-Egress: denied; reason=provider_fetch_refused
{"error":"provider_fetch_refused", "reason":"the request asks the model provider to reach other hosts or run tools itself: tool type web_search_20250305, which the provider runs itself at $.tools[0]", "construct":"tool type web_search_20250305, which the provider runs itself","json_path":"$.tools[0]", "host":"api.anthropic.com","method":"POST","path":"/v1/messages","hint":"…"}An allowed body is sent byte for byte as it came; one that came in chunks is sent with its length.
Responses
Section titled “Responses”On a credentialed route Axocoatl searches each response’s status line, headers, body
and trailers for the credential and, for basic, its base64 form. The body is
searched as it streams: the last bytes that could start a match are held back until
the next part arrives, so when the credential appears, the connection is closed
before any part of it reaches the client. The response is recorded as credential_reflected.
The search reads bytes as the host sent them, so it cannot see inside a compressed
body. A credentialed route therefore refuses responses with a Content-Encoding
(or a Transfer-Encoding other than chunked) unless it sets
allow_encoded_responses: true, which validation warns about. The search finds the
credential as it was sent; a host that returns it transformed, for example escaped or
hashed, is not caught.
A credentialed route also removes Set-Cookie and Set-Cookie2 from the response’s
headers and trailers, so a session the host starts for the credential does not reach
the container. The response’s response event counts them (cookies_dropped), and
Session network shows the count. allow_set_cookie: true keeps them, for a tool
that needs the cookie, and validation warns about it.
Records
Section titled “Records”A connection to a route’s host is recorded like any other, as an open event whose
rule is the route (route#0); its close says why the daemon ended it when it was
not an ordinary close, such as sni_mismatch for a client that named another server.
Each request on a route is written to the Session’s network record before it is
sent: a request event with the connection, its number on that connection, the
method, the path without its query, the host, the rule that allowed it (such as
route#0.rules[1]) and the credential’s name. If that write fails, the request is
refused. Refused requests are recorded with their reason. When an allowed request
ends, a response event adds the status, the bytes each way, the time, how it
ended (completed, upstream_failed, credential_reflected, encoded_response,
too_large or client_closed) and, when the route removed any, cookies_dropped.
An activation’s network evidence lists its route requests after its connections,
for example github.com POST /acme/app.git/git-receive-pack 200 (credential github). Session network lists every route request under Requests on
routes, newest first, with the rule that allowed it or the reason it was refused.