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”)
Conformance
Section titled “Conformance”The guest’s own key
Section titled “The guest’s own key”- Call the model API with an attacker-supplied key, and see that it is replaced.
The placeholder in a request
Section titled “The placeholder in a request”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-AuthorizationorCookieto any inspected host, or inx-api-keyto 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, toplatform.claude.comand to another inspected host. See each request get a403that names the binding, an audit event, and nothing sent upstream. - Send it in a form-encoded,
multipart/form-dataand JSON body toplatform.claude.comand to another inspected host, exact and percent-encoded. See the same403withplaceholder-outside-binding, the upstream request aborted, and no byte of the placeholder upstream. - Send it in the JSON body of a
/v1/messagesrequest toapi.anthropic.com. See a403withmodel-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 seeplaceholder-outside-binding. - In Claude Code, print the placeholder into the conversation, and see
the next turn and a
/compactget the same403, and a turn after/clearpass.
Bodies split across reads
Section titled “Bodies split across reads”- Send it in a chunked body split across two chunks, and across two
HTTP/2
DATAframes, 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-proxydholding 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
403and then the guest connection closed. - Send a request with
Content-Encoding: gziptoapi.anthropic.comand toplatform.claude.com, and see each get a403withmodel-content-encodingand nothing sent upstream.
Placeholders
Section titled “Placeholders”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-proxyda 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 towb-hostd, and a 5019 event withplaceholder-invalidnaming the VM and the binding. - Send
wb-hostda placeholder record that fails its form check, and see the waiting session start refused withplaceholder-record-invalid, andwb-proxydended, 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”).
What is injected
Section titled “What is injected”- 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 asAuthorization: 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/serversand/api/hello, and see them allowed with nothing injected.
The event log
Section titled “The event log”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 rulemodel-event-log. - Send
/api/%65vent_logging/,/api%2Fevent_logging/and/api%2fevent_logging/, and see each refused with the rulemodel-path-escape.
Claude Code end to end
Section titled “Claude Code end to end”- Run
wb claude -p,wb claude -p --resumeand an interactivewb claudewith the model API profile, and see each answer. In the audit log, see no request to/api/event_logging/, and no DNS lookup and no approval request for Datadog’s log intake,downloads.claude.aiandraw.githubusercontent.com. That shows the guest’s variables stopped them (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”). - Run them again with
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICandDISABLE_UPDATESunset and every approval request denied. See the event log refused with the rulemodel-event-log, the hosts outside the profile refused as unknown destinations, and Claude Code still answer (B60-model-credentialB60-model-credential: Can Claude Code in the guest hold only a placeholder while the proxy adds the real subscription token?Yes, for a long-lived token from claude setup-token.).
Status: Draft