redact-proxy pre-release
Docs menu

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 agent container (no capabilities, default route via the proxy, DNS at 192.0.2.1) sits on an internal macvlan network with the proxy container. The proxy's firewall sends DNS to a sinkhole, 192.0.2.1 port 8080 to the LLM endpoint, port 8081 to the git endpoint, and all other TCP to the gateway; everything else is dropped. The LLM endpoint talks to api.anthropic.com, redacting both ways. The git endpoint, present when the workspace is a git repository, runs real git on your repository. The gateway reaches allowlisted hosts with HTTP and TLS inspection and puts markers back by rule; other TCP to an allowlisted host is tunneled uninspected. Anything not allowlisted is refused.

The two containers#

Agent container#

Proxy container#

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:

agent routes
<proxy's address> dev eth0 scope link
default via <proxy's address> dev eth0

The 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#

EndpointAddressSet in the agent as
LLM endpoint192.0.2.1:8080ANTHROPIC_BASE_URL
Git endpoint (only for a workspace with a .git directory)192.0.2.1:8081REDACTPROXY_GIT_URL
DNS sinkhole192.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:

  1. DNS, UDP and TCP port 53 to any address, goes to the sinkhole.
  2. TCP for 192.0.2.1 on an endpoint's port goes to that endpoint.
  3. All other TCP goes to the gateway, which reads the original destination (SO_ORIGINAL_DST).
  4. 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.

Don't allowlist names that resolve to internal addresses

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:

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.

Detection#

Scanning runs in this order, and a hit at any step becomes a marker:

  1. Known values from the store, including encoded forms: base64 in all three alignments, URL and JSON escapes, and chunks.
  2. Token formats, from the vendored gitleaks rules.
  3. Context: key names such as password, secret, token, JSON keys and environment variable names; URL userinfo; connection strings.
  4. 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:

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.

ModeA marker is put back
defaultToward 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.
paranoidOnly 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:

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#

shell
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 4

It 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.

In progress

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.

CheckWhat it proves
dns-syntheticNames resolve to the sinkhole's synthetic range.
dns-direct-udp, dns-direct-tcpDNS to an outside resolver doesn't get out.
docker-dnsDocker's own resolver at 127.0.0.11 doesn't forward around the sinkhole.
ip-literalA connection to a raw IP doesn't bypass the gateway.
anthropic-directAnthropic can't be reached except through the LLM endpoint.
udp, ipv6UDP and IPv6 don't get out.
llm-endpointA canary sent through the LLM endpoint comes out redacted in the proxy's log.
tls-curl, tls-wget, tls-node, tls-python3Informational, 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.

SubscriptionAPI key
Keychain accountclaude-oauth-tokenanthropic-api-key
Sent to Anthropic asAuthorization: Bearer …X-Api-Key: …
Dummy in the agentCLAUDE_CODE_OAUTH_TOKENANTHROPIC_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.