How it works
Two containers with a network namespace each, generated per workspace and started by redactproxy launch. The agent's only network leads to the proxy, and every packet it sends arrives there, whatever address it dials.
The two containers#
Agent container#
- Runs with
cap_drop: ALLandno-new-privileges, as the base image's user: non-rootnodein the default image; a custom-agent-basethat runs as root stays root, without capabilities. No Docker daemon. - Its only network is
sandbox, an internal macvlan network with no gateway and no IPv6. /etc/resolv.confpoints at192.0.2.1.- Its image is your base image with the proxy CA added to the system store, Java's store (when
keytoolexists) and the usual variables:NODE_EXTRA_CA_CERTS,SSL_CERT_FILE,REQUESTS_CA_BUNDLE,PIP_CERT,CURL_CA_BUNDLE,GIT_SSL_CAINFO,CARGO_HTTP_CAINFOand others. - When the workspace is a git repository (a
.gitdirectory), itsgitis a shim that sends commands to the proxy (see Git).
Proxy container#
- Its entrypoint runs
redactproxy firewallas root withNET_ADMIN, reads the rules back withiptables-saveand refuses to start unless they are in force exactly as written. - It then drops to the launcher's user with no capabilities and serves.
- It is on
sandboxand on an ordinarydefaultnetwork; its own connections leave throughdefault.
The sandbox network#
Docker gives the agent one route, to the sandbox subnet. A one-shot helper, the routes service (the proxy image, in the agent's network namespace, with NET_ADMIN), replaces it with two:
<proxy's address> dev eth0 scope link
default via <proxy's address> dev eth0The launcher runs the helper after the containers start and before anything runs in the agent. If it fails, the launcher stops the sandbox. The agent has no capabilities, so it can't change the routes.
It fails closed. Before the helper has run, and again after a restart of the agent container, the agent has Docker's one route. It reaches the proxy's address only, where the rules drop what wasn't redirected.
sandbox is macvlan rather than a bridge because on an internal bridge network the host drops packets for addresses outside the subnet before they reach the proxy.
The reserved address#
| Endpoint | Address | Set in the agent as |
|---|---|---|
| LLM endpoint | 192.0.2.1:8080 | ANTHROPIC_BASE_URL |
Git endpoint (only for a workspace with a .git directory) | 192.0.2.1:8081 | REDACTPROXY_GIT_URL |
| DNS sinkhole | 192.0.2.1:53 | /etc/resolv.conf |
No interface has this address. It is from 192.0.2.0/24, reserved for documentation (RFC 5737), so no real host has it either. It exists only as rules in the proxy, which hand its packets to the right listener.
The proxy's rules#
For packets arriving from the agent:
- DNS, UDP and TCP port 53 to any address, goes to the sinkhole.
- TCP for
192.0.2.1on an endpoint's port goes to that endpoint. - All other TCP goes to the gateway, which reads the original destination (
SO_ORIGINAL_DST). - Everything else is dropped: the agent's other UDP, ICMP and IPv6.
Nothing is forwarded, and the proxy runs with net.ipv4.ip_forward=0, which holds even without the rules. The listeners are closed to the default network. An agent that dials the proxy's real address reaches the gateway like any other destination, never a listener directly.
DNS sinkhole#
Every A query gets a synthetic address from 198.18.0.0/15; AAAA answers are empty. Nothing is forwarded, so a query can't carry a value out. When the agent connects to a synthetic address, the gateway maps it back to the name and checks that name against the allowlist.
A hostname marker resolves the same way: https://__redacted_hostname_…__:6443 gets a synthetic address, and the gateway connects to the real host behind the marker.
Gateway and allowlist#
The gateway checks the real destination of every connection against your allowlist. Anything not on the allowlist is refused, so loopback, link-local and metadata addresses are unreachable unless your policy allows them. Anthropic's hosts (anthropic.com, claude.ai, claude.com and their subdomains) are refused whatever the policy says: the agent reaches Anthropic only through the LLM endpoint, which redacts.
An allowlisted name is dialled wherever it resolves, 127.0.0.1 or 169.254.169.254 included. A built-in block for loopback, link-local and metadata addresses is in progress; until then, keep such names off the allowlist.
HTTP and TLS connections go to the egress inspector. Hosts listed under passthrough get their TLS tunneled undecrypted, for clients that pin certificates; the launcher prints them as "not inspected".
Anything else to an allowlisted host and port is tunneled as raw TCP, with no request check and no response redaction. That includes ports 80 and 443 when the first bytes are neither a TLS record nor a standard HTTP method, or the client stays silent for 300 ms.
TLS interception#
Each workspace has its own proxy CA, kept in its state directory. Its key is encrypted with the store key; it signs a short-lived leaf certificate per name. The inspector terminates the agent's TLS with that leaf, opens its own TLS connection to the real host (trusting the system roots and any -upstream-ca-file PEMs), then:
- On each request, puts markers back where the rules allow, and blocks or queues a real known value leaving where it shouldn't.
- On each response, redacts what it finds and registers new markers. A token learned from a host's response is recorded as issued by that host; paranoid mode puts it back only there.
- On git pushes over smart HTTP, unpacks the pack in a sandboxed child process and blocks the push if it holds markers or known values that aren't allowed there.
- On Kubernetes traffic, asks for JSON instead of protobuf, redacts Secrets by structure and streams watches and followed logs line by line (see Kubernetes).
- On mTLS, swaps the client-certificate stand-in for the real certificate in the upstream handshake, only for the server that asks for the real one's issuer.
Archives from public package registries pass unscanned. Other binary responses are scanned for known values. From hosts you list in data_hosts, an archive too large to decompress and scan (over 64 MiB) is refused instead of streamed.
The LLM endpoint#
Claude Code runs with ANTHROPIC_BASE_URL=http://192.0.2.1:8080. The endpoint forwards only POST /v1/messages and /v1/messages/count_tokens; anything else gets a 403.
- Every request is redacted, string by string, nested JSON included. The provenance of thinking and signed blocks is kept.
- The agent's dummy credential is replaced with the real one: a subscription token as
Authorization: Bearer, or an API key asX-Api-Key. - Every response is redacted, streams included.
- It fails closed. If redaction fails, nothing is forwarded.
- When the model calls a tool, markers in the tool's input are restored to real values only where the sandbox already holds that value in real form, so edits to non-secret files still match.
- Output of secret-heavy tools (
printenv, reading.env,kubectl get secret,helm get) is scanned under a stricter profile;git logandgit blameunder one for authorship.
Detection#
Scanning runs in this order, and a hit at any step becomes a marker:
- Known values from the store, including encoded forms: base64 in all three alignments, URL and JSON escapes, and chunks.
- Token formats, from the vendored gitleaks rules.
- Context: key names such as
password,secret,token, JSON keys and environment variable names; URL userinfo; connection strings. - Structures: PEM, OpenSSH and PGP blocks, JWTs, IP addresses, internal hostnames, personal data.
Before scanning, text is decoded up to two layers deep (base64, percent-encoding, \u and \x escapes, hex). When a new value is learned, the whole text is swept again for it. Your own exact strings can be declared (type declared). Regexes are Go RE2, which runs in linear time, so hostile content can't hang the scanner.
Detection is not perfect. What it misses is listed under limitations.
Pre-session scrub#
Before the agent starts, the launcher gives it marker copies of:
- Secret files in the workspace, matched by name, case-insensitively:
.env,.env.*,*.env,credentials,credentials.json|yaml|yml,.npmrc,.pypirc,.netrc,_netrc,.pgpass,.git-credentials,id_rsa|id_dsa|id_ecdsa|id_ed25519,*.key|pem|p12|pfx|jks|keystore|tfvars|tfstate,secret(s).yaml|yml|json|toml|env,service-account*.json,kubeconfig,.htpasswd,.vault-token,.dockercfg; and by path:.aws/credentials,.aws/config,.docker/config.json,.kube/config,.config/gh/hosts.yml. Files ending in.example,.sample,.template,.distor.tmplare skipped, and so is anything undernode_modules/. - The
-env-filethe agent's environment comes from. - Credential files given with
-mount, mounted read-only.
The copies sit in an overlay; nothing is changed in place. Certificates and keys in them get stand-ins. Non-secret workspace files are bind-mounted as they are: the agent edits your real files.
The marker store#
The map from markers to values lives at ~/.redactproxy/<project>/store.bin, encrypted with AES-256-GCM. A marker's ID is a 128-bit keyed HMAC-SHA256 of the value, so the same value always gets the same marker. The store key stays in the macOS Keychain (account store-key) and reaches the proxy as a Compose secret. A running proxy is the store's only writer.
Put-back rules#
A marker becomes the real value only on a request leaving the proxy, and only where the rules allow. A position is one of auth, header, url or body.
| Mode | A marker is put back |
|---|---|
default | Toward any allowlisted host, in any position; a put-back into a body is logged as a warning. On public-surface hosts (github.com, slack.com, npm, pastebin.com, webhook.site, ngrok and others) only in the auth position; a request with a marker elsewhere is refused and queued. |
paranoid | Only when the value is bound to the destination, and only in the auth position: a provider rule (a GitHub token to github.com, a Stripe key to api.stripe.com, an OpenAI key to api.openai.com) or a token learned from that host's response. Anything else is blocked and queued for approval. |
In every mode:
- Personal data is never put back: email, phone, card, IBAN, national ID.
- A marker that can't be put back stops the request: it gets a 403, and nothing is sent upstream.
- A real known value leaving in clear is blocked unless the sandbox's own files hold it and it goes to its bound host (auth position) or where you approved it. Exception: personal data already in the sandbox's files is not blocked on the way out, only logged.
- SSH keys given with
-ssh-keynever enter the sandbox; they are used through the ssh-agent socket. - In paranoid mode, a cookie or token learned from a host's response is put back only toward that host, in the auth position. In default mode it resolves toward any allowlisted host, like any other marker.
- Base64 is handled: HTTP Basic
user:<marker>is re-encoded with the real value, and base64 of a marker in a request body is put back.
Approvals#
When a put-back or an outgoing real value is blocked for a reason you can approve (an unbound value, a public-surface position), it is queued: what kind of value, its marker ID, the rule, the host, the position, how often and when it was last seen.
Between sessions#
redactproxy approvals -store <state>/store.bin -store-key-file <file> -container-id <id> list
redactproxy approvals -store <state>/store.bin -store-key-file <file> -container-id <id> approve 3
redactproxy approvals -store <state>/store.bin -store-key-file <file> -container-id <id> deny 4It runs against the store while no proxy is using it. It needs the store key as a file of 64 hex characters (this means writing the store key to a file yourself; delete it afterwards) and the ID the launcher assigned, which is kept in <state>/container-id. The launcher keeps the store key in the Keychain and has no wrapper for this command yet, so today it is a low-level tool.
A runtime console in the launcher's terminal, so you can decide while the agent waits: list, approve N, deny N, fp MARKER-ID, resume. An approval applies to one marker, host and position and is remembered; a base64 put-back always asks. It exists on a separate development branch and is being brought into the build these docs describe.
SSH#
Keys given with -ssh-key stay in the proxy. The agent gets an ssh-agent socket that can list keys and sign, nothing else. SSH itself is raw TCP and is not inspected. For allowlisted git hosts, the agent image rewrites git@host: and ssh://git@host/ remotes to HTTPS, where the gateway can inspect pushes.
Self-test#
Every launch runs these checks in the agent container. A failed required check stops the sandbox.
| Check | What it proves |
|---|---|
dns-synthetic | Names resolve to the sinkhole's synthetic range. |
dns-direct-udp, dns-direct-tcp | DNS to an outside resolver doesn't get out. |
docker-dns | Docker's own resolver at 127.0.0.11 doesn't forward around the sinkhole. |
ip-literal | A connection to a raw IP doesn't bypass the gateway. |
anthropic-direct | Anthropic can't be reached except through the LLM endpoint. |
udp, ipv6 | UDP and IPv6 don't get out. |
llm-endpoint | A canary sent through the LLM endpoint comes out redacted in the proxy's log. |
tls-curl, tls-wget, tls-node, tls-python3 | Informational, only with -allowed-url: which tools trust the proxy CA. |
Claude's credential#
The proxy holds the credential Anthropic accepts; the agent holds a dummy of the same kind, replaced on every request to the LLM endpoint.
| Subscription | API key | |
|---|---|---|
| Keychain account | claude-oauth-token | anthropic-api-key |
| Sent to Anthropic as | Authorization: Bearer … | X-Api-Key: … |
| Dummy in the agent | CLAUDE_CODE_OAUTH_TOKEN | ANTHROPIC_API_KEY |
The launcher reads it from the Keychain (service redactproxy) and passes it to the proxy as a Compose secret through the environment. It is never written to the host's disk. With both present, the subscription token is used.