Skip to Content
Advanced FeaturesAI Data Redaction

AI Data Redaction

When an AI agent reads captured traffic through APXY, APXY masks passwords, emails, tokens, and other secrets first. The agent still sees which fields each request has and can tell one token from another. It does not see the secret values.

APXY masks the data when it is read. The traffic stored on your machine stays raw, and the local Web UI shows it unchanged.

Before and after

This request is captured once. The Web UI shows it as sent:

POST https://api.corp.vn/v1/users/alice.nguyen@corp.vn/reset?otp=482913&token_type=bearer Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0MiJ9.c2lnbmF0dXJl Cookie: session=9f8e7d6c5b4a3210 { "api_key": "sk_live_51Habc123456", "email": "alice.nguyen@corp.vn", "email_verified": true, "max_tokens": 1024, "newPassword": "Hunter2-Very-Secret", "tool_call": { "arguments": "{\"notify\":\"bob.tran@corp.vn\",\"user_password\":\"s3cret!\"}", "name": "reset_password" } }

An agent that calls the get_traffic_log MCP tool or runs apxy logs show --id <id> --output agent gets the same record with these values:

POST https://api.corp.vn/v1/users/a***@corp.vn/reset?otp=%2A%2A%2A&token_type=bearer Authorization: Bear***dXJl Cookie: sess***3210 { "api_key": "sk_l***3456", "email": "a***@corp.vn", "email_verified": true, "max_tokens": 1024, "newPassword": "***", "tool_call": { "arguments": "{\"notify\":\"b***@corp.vn\",\"user_password\":\"***\"}", "name": "reset_password" } }

In a query string, the mask is URL-encoded, so *** appears as %2A%2A%2A.

What APXY masks

ValueExamplesThe agent sees
Value under a password keypassword, newPassword, user_password, passwd, passphrase, pwd, otp***
Value under another secret keytoken, access_token, api_key, client_secret, private_key, session_tokenFirst 4 and last 4 characters, such as sk_l***3456. A value of 8 characters or fewer becomes ***.
Sensitive headerAuthorization, Cookie, Set-Cookie, X-Api-Key, X-Auth-Token, X-Client-SecretFirst 4 and last 4 characters, such as Bear***dXJl
Email address, under any key or in any textalice.nguyen@corp.vna***@corp.vn
Number, object, or array under a secret key"secret": 12345***
Binary body or uploaded fileAn image upload[binary data]

These values stay readable:

  • true, false, and null under a secret key, because they cannot hold a secret. email_verified: true stays true.
  • LLM request fields such as max_tokens, token_type, and cache_key.

How APXY matches key names

APXY compares key names after it lowercases them and removes _, -, ., and spaces. So newPassword, new_password, and New-Password all match.

A key is sensitive when its name contains one of these words: password, passwd, passphrase, secret, apikey, accesstoken, refreshtoken, idtoken, authtoken, sessiontoken, privatekey, authorization, cookie, or email.

Short names match only as the whole key name. In bodies, these names are token, pwd, and otp. In query strings, key and signature also match. For this reason, max_tokens and cache_key stay visible. Also, user_pwd and otp_code are not masked.

JSON inside strings

AI tool calls often send their arguments as a JSON document inside a string. APXY parses that string and masks the keys inside it, as the tool_call in the example shows. A string that holds JSON with nothing to mask keeps its original text.

Where masking applies

APXY masks these parts of each record:

  • The URL path and the query string.
  • Request headers and response headers.
  • JSON, form, multipart, and plain-text bodies.
  • WebSocket frame payloads.
  • Server-Sent Events (SSE) event data.

MCP tools

All MCP tools that return traffic mask it: list_traffic_logs, get_traffic_log, search_traffic_logs, and get_ws_frames. The other MCP tools do not return captured traffic.

CLI in agent mode

The CLI masks traffic when it runs in agent mode. Agent mode is on in these cases:

  • You pass --output agent.
  • The APXY_OUTPUT environment variable is agent.
  • Neither is set, and stdout is not a terminal. For example, stdout goes to a pipe, a file, or an AI agent’s shell tool.

Pass --output human to turn agent mode off.

In agent mode, these commands mask the traffic that they print:

CommandWhat is masked
apxy logs list, logs show, logs search, logs tailEach record
apxy logs search-bodies, logs jsonpath, logs diff, logs graphqlThe records that the command reads, before it searches, queries, or compares them
apxy logs ws-framesFrame payloads and connection URLs
apxy logs sse-eventsThe data of each event
apxy logs sse-mergeThe merged content and tool calls
apxy logs replayThe response that the command prints
apxy logs export-curl, logs export-harThe export
apxy breakpoint pendingThe URLs of paused requests
apxy schema validate, schema validate-recentThe request paths in issue texts

Search does not confirm hidden values

In agent mode, apxy logs search, apxy logs search-bodies, and the search_traffic_logs MCP tool return a record only when its masked data contains the query. A search for a value that APXY masks, such as a password or a full email address, returns no records. An agent cannot use the search result to confirm a guess.

Exports

In agent mode, apxy logs export-curl and apxy logs export-har export masked data by default. In a terminal, they export raw data and print a warning. Add --safe (or its alias --redact) to mask the export in a terminal.

A redirect makes stdout a file, so the CLI runs in agent mode. apxy logs export-har > recording.har writes a masked HAR file. To write a raw HAR file, run apxy logs export-har --file recording.har in a terminal, or add --output human.

What stays raw

  • Stored traffic. APXY saves traffic on your machine unchanged and masks it only when an agent reads it.
  • The local Web UI. It shows each record as captured.
  • Human terminal output. In a terminal, or with --output human, the CLI prints values as captured. There are two exceptions. apxy logs list, logs show, and logs search with --format json mask values unless you add --raw. apxy wait always prints a masked record.
  • Replayed requests. apxy logs replay sends the original request with its real credentials.
  • Checks. apxy wait --expect and apxy schema validate evaluate the raw record. The actual values that apxy wait reports come from the masked record.

Limits

Redaction keeps secrets from entering a model’s context by accident. It is not a sandbox. An agent with shell access can read the local traffic database or run the CLI with --output human.

  • Unknown key names. APXY masks only the key names listed above. A secret under another name, such as user_pwd or pin, stays visible unless it is an email address.
  • Text that looks like an email. git@github.com:org/repo.git becomes g***@github.com:org/repo.git.
  • Secrets split across SSE events. apxy logs sse-events masks each event on its own. When a streamed response splits a secret across delta events, the parts can appear unmasked. apxy logs sse-merge joins the events first and then masks the result. apxy wait does the same for sse.text.
Last updated on