Skip to content

Outbound Secret Firewall

The outbound secret firewall checks every request that carries a tracked secret before Recon opens a connection. If a secret is about to go to a host outside its allowlist, or into a URL query parameter, the request is blocked and nothing is sent. Use it to keep production keys away from local servers, webhook catchers and logged query strings.

recon init --demo writes a PROD_STRIPE_KEY secret that may only go to api.stripe.com, plus a request called Stripe Prod Key Leak Check that sends it to the local sandbox on purpose.

Terminal window
recon init --demo
recon send "Stripe Prod Key Leak Check"
error E_FIREWALL_BLOCKED: Blocked secret `PROD_STRIPE_KEY` bound for `api.stripe.com` from being sent to unauthorized host `127.0.0.1`.
hint: Switch environment or update secret allowed_hosts.

The command exits with code 1. No connection is made and no Flight Recorder run is written.

The secret that caused this lives in environments/local.toml:

[PROD_STRIPE_KEY]
value = "sk_live_demo_firewall_protected"
secret = true
allowed_hosts = ["api.stripe.com"]
allow_query_param = false
label = "PROD_STRIPE_KEY"

The firewall does not scan request bytes. It works from a list of taint records that Recon builds while it expands {{variables}}. Only values that arrive through one of these routes are tracked:

Source How to write it Label used in messages Allowed hosts
Secret environment variable A TOML table with value and secret = true in an environment file or under [environments.<name>] in .recon.toml label, or the variable name when label is absent allowed_hosts
$ENV: reference inside a secret value = "$ENV:STRIPE_KEY" as above as above
Secret URI A variable whose value starts with age://, env://, file://, op:// or keychain:// label, or the variable name The variable’s own allowed_hosts if set; otherwise, for age://, the vault entry’s allowed_hosts; otherwise none
Process environment template {{$env.NAME}} NAME The request’s # @taint-scope hosts, or none
OAuth 2.0 access token @auth with "kind": "oauth2" oauth2:<profile> Hosts stored with the cached token. A newly acquired token stores the request’s # @taint-scope hosts, or the request URL’s host when there is no scope.
Flow extraction An extract rule with secret = true the extracted key the rule’s allowed_hosts

See Vault & Secret URIs for the URI schemes and Flows for extract rules.

These values are not tracked:

  • Plain string variables (base_url = "...").
  • A secret whose value resolves to an empty string (for example $ENV:NAME with NAME unset).
  • Values passed as runtime overrides, such as variables set by a pre-request script. An override is used before the environment is consulted, so it replaces a secret without creating a taint record.
  • Secrets typed literally into a .http file, header or body.

Fields of a secret variable:

Field Type Default Meaning
value string required The secret, a $ENV:NAME reference, or a secret URI.
secret bool required Must be true for the value to be tracked.
allowed_hosts list of strings [] Hosts that may receive the value. An empty list means no host check.
allow_query_param bool false Allow the value inside a URL query parameter.
label string variable name Name shown in violations and in [SECRET:LABEL] placeholders.

Each taint record notes where the value was placed. This decides which rules apply.

Origin Set when the variable is used in
url_path The request URL template itself (scheme, host, path, and any query string written inline in an ad-hoc URL)
query_param An entry in the request’s query list, or @auth api_key with "location": "query"
header A header value, or bearer, basic, header api_key, AWS SigV4, HMAC and OAuth 2.0 auth
body A JSON, text, form or multipart body, and OAuth 2.0 client_id / client_secret

A .http file splits the query string of its request line into the query list, so GET {{base_url}}/v1?api_key={{KEY}} produces a query_param record for api_key.

Add # @taint-scope to a request in a .http file to restrict every secret that has no allowlist of its own:

### Request scope
# @name Request Scope
# @taint-scope api.example.com
GET {{base_url}}/v1/students
X-Api-Key: {{UNSCOPED}}

You can list several hosts separated by commas, or repeat the directive. After the request is resolved, each taint record whose allowed_hosts is empty gets the request’s scope list. A secret that already has allowed_hosts keeps its own list.

For each taint record, the firewall checks:

  1. Query parameter leak (query_param_secret_leak). The origin is query_param and allow_query_param is false.
  2. Host scope (host_scope_violation). allowed_hosts is not empty and the destination host matches none of its patterns.

One record can break both rules. All violations from all records are collected, and the request is blocked if there is at least one.

The destination host is taken from the fully resolved URL and lowercased. The port is not part of it. Each pattern is trimmed and lowercased, then compared:

Pattern Matches
* Any host.
api.stripe.com Exactly api.stripe.com.
*.stripe.com stripe.com itself and any host ending in .stripe.com.

There are no other wildcard forms. Some consequences you can observe:

  • A pattern that includes a port, such as 127.0.0.1:4210, never matches, because the host being compared has no port.
  • localhost and 127.0.0.1 are different hosts. The demo lists both.
  • IPv6 hosts are compared in bracket form. A secret scoped to ::1 is blocked when sent to http://[::1]:9/:
error E_FIREWALL_BLOCKED: Blocked secret `V6` bound for `::1` from being sent to unauthorized host `[::1]`.
  • Redirect hops. Only the initial URL is checked. When a redirect crosses to another origin, the HTTP client drops the Authorization header and keeps every other header.
  • Untracked bytes. A secret that did not come through a tracked route (see above) is invisible to the firewall.
  • Redirect hops. The check runs once, on the request as written. When the server answers with a redirect, the client follows it without a second check. It removes the Authorization header when the origin changes, and nothing else. See Transport: TLS, Proxy & Cookies.
  • WebSocket messages and gRPC request messages. The firewall checks the connection request (URL and headers). Message payloads are sent as written and are not template-expanded.

Each violation has these fields:

Field Meaning
secret_label Label of the secret.
kind host_scope_violation or query_param_secret_leak.
target_host Lowercased destination host.
allowed_hosts The secret’s allowlist.
origin url_path, query_param, header or body.
target_name Header, query, form or multipart field name, when known.
message Human-readable explanation.

The two message forms are:

Secret `<label>` attempted to transmit inside URL query parameter `<name>` (query strings appear in proxy/server access logs).
Blocked secret `<label>` bound for `<allowed hosts, comma-separated>` from being sent to unauthorized host `<host>`.

recon send, recon load, recon paginate, recon sse, recon ws, recon graphql and recon grpc print an E_FIREWALL_BLOCKED error and exit with code 1. All violation messages are joined with ; . With --format json or --format agent the envelope is written to stderr:

Terminal window
recon send Double --format json
{
"code": "E_FIREWALL_BLOCKED",
"message": "Secret `QUERY_KEY` attempted to transmit inside URL query parameter `api_key` (query strings appear in proxy/server access logs).; Blocked secret `QUERY_KEY` bound for `127.0.0.1` from being sent to unauthorized host `elsewhere.invalid`.; Blocked secret `PORT_SCOPED` bound for `127.0.0.1:4210` from being sent to unauthorized host `elsewhere.invalid`.",
"fix_hint": "Switch environment or update secret allowed_hosts.",
"retryable": false
}

Other commands report blocks differently:

Command Result
recon test The case fails with Firewall blocked N violation(s); other cases still run; exit code 1 if any case failed.
recon twin E_CLI_RUNTIME: outbound secret firewall blocked N violation(s), exit code 2.
recon flow run The step fails with an error starting E_FIREWALL_BLOCKED:.
recon watch The impacted request is reported as failed with the error text.

Routes return HTTP 403 with the full violation list:

{"code":"E_FIREWALL_BLOCKED","message":"Outbound Secret Leak Firewall blocked 1 violation(s) before connecting.","violations":[{"allowed_hosts":["api.stripe.com"],"kind":"host_scope_violation","message":"Blocked secret `PROD_STRIPE_KEY` bound for `api.stripe.com` from being sent to unauthorized host `127.0.0.1`.","origin":"header","secret_label":"PROD_STRIPE_KEY","target_host":"127.0.0.1","target_name":"Authorization"}]}

recon_send_request returns a tool error with only the count, for example E_FIREWALL_BLOCKED: outbound secret firewall blocked 1 violation(s). recon_twin_run returns the same text without the E_FIREWALL_BLOCKED: prefix. The agent policy check runs before the firewall, so a blocked mutating call may first wait for human approval. See Agent Policy & Approvals.

The only bypass is a single-request override for a human in the web studio:

  • In the UI, the Outbound Secret Leak Blocked Pre-Flight dialog lists each violation and offers Override Once or Keep Blocked. Override Once re-sends the active request.
  • Over HTTP, send "override_firewall_once": true in the POST /api/v1/send body. If the firewall blocks, the request is sent anyway.

The override exists only on POST /api/v1/send. The CLI, MCP tools, twin runs, flows, load tests and protocol routes have no override. The run is recorded like any other run; nothing in the Flight Recorder marks that an override was used. Recorded request headers still show the secret as a placeholder:

{"name": "Authorization", "value": "Bearer [SECRET:PROD_STRIPE_KEY]"}

When Recon stores or prints a request that carried tracked secrets, it replaces each secret value, and its Base64 form, with [SECRET:<label>]. This applies to the recorded URL, request headers and request body, to script log lines and to post-script captured variables. The Base64 form matters for HTTP Basic auth, where the header carries base64(user:password).

The one-line summary that recon send prints in human mode shows the final URL as received, so a secret you allowed into a query string with allow_query_param = true appears there in clear text.

Path Firewall check
recon send, recon test, recon watch, web studio send Every request.
recon twin, POST /api/v1/twin, recon_twin_run Both sides, before either is sent.
OAuth 2.0 token requests The token exchange request.
GraphQL, SSE, WebSocket, gRPC call and gRPC reflection The HTTP request or connection handshake.
recon paginate Every page, including 429 retries.
recon load Once, before any worker starts.
Flows (recon flow run, recon_run_flow, POST /api/v1/flows/run) Every step.
recon capsule reproduce Runs, but the replayed request has no tracked secrets, so only the URL is validated.
recon proxy capture and recon shadow Runs with no taint records. Only URL validity is checked. A failure returns 403 from the proxy.
recon mock Serves recorded responses; makes no outbound requests.
  • HTTP: POST /api/v1/send (with override_firewall_once), and every route that sends traffic returns 403 with E_FIREWALL_BLOCKED. See HTTP API.
  • MCP: every network tool. See MCP Tools.
  • Web studio: the firewall dialog after Send. See Web Studio.
  • Error code: E_FIREWALL_BLOCKED in Error Codes.