Skip to content

C06 - Model API

Purpose: The test cases for the model credential: its placeholder, the scan for the placeholder in whole requests, what is injected on the model API, the event log, and Claude Code end to end.

Verifies: S07-08-requests-and-credentialsS07-08-requests-and-credentials: Requests and CredentialsThe form of each request wb-proxyd sends upstream, and how it removes the guest's credentials and injects bound ones. (“Credential replacement”), S07-09-placeholder-bindingS07-09-placeholder-binding: Placeholder BindingWhere a credential placeholder may go in a request, how wb-proxyd scans for it, and what it refuses. (“Bounds”), S07-11-http-policyS07-11-http-policy: HTTP PolicyThe HTTP rules of inspected hosts, the built-in profiles, and the parts a user can turn off. (“model API”), S09-05-credentialsS09-05-credentials: CredentialsHow credentials are stored and bound to requests, and how the model credential reaches the model API without entering the guest. (“Model credential”), S06-08-projects-and-sessionsS06-08-projects-and-sessions: Projects and Sessions Inside a VMHow projects map onto guest users and sessions onto worktrees, and how Claude Code runs in the guest. (“Claude Code in the guest”), S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs. (“Accounting and event channels”)

  • Call the model API with an attacker-supplied key, and see that it is replaced.

S07-08-requests-and-credentialsS07-08-requests-and-credentials: Requests and CredentialsThe form of each request wb-proxyd sends upstream, and how it removes the guest's credentials and injects bound ones., “Credential replacement”, and S07-09-placeholder-bindingS07-09-placeholder-binding: Placeholder BindingWhere a credential placeholder may go in a request, how wb-proxyd scans for it, and what it refuses.. The scan covers whole requests, not only Authorization and x-api-key.

  • Send the model credential’s placeholder in Authorization, Proxy-Authorization or Cookie to any inspected host, or in x-api-key to a host in the model API profile. See the header removed before policy runs, logged with its name and rule, and the request not refused for it.
  • Send it in any header that isn’t removed there, or in a query string, to api.anthropic.com, to platform.claude.com and to another inspected host. See each request get a 403 that names the binding, an audit event, and nothing sent upstream.
  • Send it in a form-encoded, multipart/form-data and JSON body to platform.claude.com and to another inspected host, exact and percent-encoded. See the same 403 with placeholder-outside-binding, the upstream request aborted, and no byte of the placeholder upstream.
  • Send it in the JSON body of a /v1/messages request to api.anthropic.com. See a 403 with model-placeholder-in-body, whose message says the placeholder is in the conversation and to clear the conversation (/clear) or start a new session, and no byte of the placeholder upstream.
  • Send it in a body to another path of the binding, such as /api/eval/, and see placeholder-outside-binding.
  • In Claude Code, print the placeholder into the conversation, and see the next turn and a /compact get the same 403, and a turn after /clear pass.

Spec: S07-09-placeholder-bindingS07-09-placeholder-binding: Placeholder BindingWhere a credential placeholder may go in a request, how wb-proxyd scans for it, and what it refuses., “Bounds”.

  • Send it in a chunked body split across two chunks, and across two HTTP/2 DATA frames, at every offset in the placeholder, exact and percent-encoded. See each request refused with no byte of the placeholder upstream.
  • Send the same bodies with the placeholder’s last character changed, and see them forwarded unchanged, with wb-proxyd holding back no more than the window.
  • Send it late in a body to a stand-in upstream that answers before the body ends. See the guest get a reset stream over HTTP/2 and a closed connection over HTTP/1.1.
  • Send it in a body over HTTP/1.1 to an upstream that waits, and see the 403 and then the guest connection closed.
  • Send a request with Content-Encoding: gzip to api.anthropic.com and to platform.claude.com, and see each get a 403 with model-content-encoding and nothing sent upstream.

Spec: S09-05-credentialsS09-05-credentials: CredentialsHow credentials are stored and bound to requests, and how the model credential reaches the model API without entering the guest., “Model credential”.

  • Create two VMs with the same stored credential, and see two different placeholders, each with the credential’s length and prefix.
  • Store a credential with a prefix outside the fixed pattern, and see a placeholder random throughout. Store one shorter than 32 characters, and see a placeholder with at least 32 random characters.
  • Store a new value with wb cred set, and see a new placeholder in the next session and the old one still refused.
  • Suspend and resume the VM, and restart wb-proxyd, and see both placeholders unchanged and both still refused outside their binding.
  • Store nine values in turn, and see the oldest placeholder dropped from the set.
  • Hand wb-proxyd a placeholder set holding one placeholder that is too short, one with a character outside letters, digits and -, and one that is a substring of the stored credential. See each discarded, a fresh one drawn and sent to wb-hostd, and a 5019 event with placeholder-invalid naming the VM and the binding.
  • Send wb-hostd a placeholder record that fails its form check, and see the waiting session start refused with placeholder-record-invalid, and wb-proxyd ended, counted toward the restart limit and restarted (S04-08-records-and-boundsS04-08-records-and-bounds: Records, Versions and BoundsThe records daemons send wb-hostd, the build version rules between processes, the bounds on host work a guest can cause, and logs., “Accounting and event channels”).
  • With a long-lived token stored, send a request to each path of the binding on api.anthropic.com, and see the token injected only as Authorization: Bearer.
  • With an API key stored, send the same requests, and see the key injected only as x-api-key.
  • Send requests to /mcp-registry/v0/servers and /api/hello, and see them allowed with nothing injected.

Spec: S07-11-http-policyS07-11-http-policy: HTTP PolicyThe HTTP rules of inspected hosts, the built-in profiles, and the parts a user can turn off., “model API”.

  • With a global policy that allows api.anthropic.com /api/event_logging/, and with one that allows /api/, send a request to /api/event_logging/, and see it refused with the rule model-event-log.
  • Send /api/%65vent_logging/, /api%2Fevent_logging/ and /api%2fevent_logging/, and see each refused with the rule model-path-escape.

Status: Draft