X01 - Model credential via the proxy
Purpose: The result of the spike for I60I60 (closed): X01-model-credential: API key mode via the proxySplit from #15 (X01-model-credential) during triage on 2026-10-04., the part of I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh? that doesn’t need a browser login, and for the browser login in I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh? (“Browser login (I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh?)”). Does Claude Code work with a placeholder credential while a host-side proxy injects the real one, and which hosts does it contact, for the model API profile of S07-egress-gatewayS07-egress-gateway: Egress GatewayThe only path from a guest to any network: a userspace network stack (wb-netd) and a policy-enforcing proxy (wb-proxyd) on the host.?
Requirements: SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential., SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable., SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter., FR01-drop-inFR01-drop-in: Drop-in for claudewb is the single entry point for everything, structured as wb [wb flags] <command> [command args]., FR13-claude-stateFR13-claude-state: Claude Code state per projectClaude Code's conversation history, and the state it keeps only in the guest, persist per project, so --resume/--continue work within a project.
Brief: 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., and B15-browser-loginB15-browser-login: Can Claude Code in the guest run on a browser login while the host keeps the real tokens?Yes, with conditions. for I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh?
For review
Section titled “For review”The browser login (I15)
Section titled “The browser login (I15)”- Decides: whether V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there. supports a browser login as a model credential, and whether the terminal filter hides the authorize URL Claude Code prints in a guest.
- You are approving: the answer “yes, with conditions” for a
browser login. With placeholder access and refresh tokens in Claude
Code’s store, and the proxy holding the real pair and answering the
refresh, Claude Code answered in
-p,-p --resumeand an interactive session, across two forced refreshes. The conditions: only the host refreshes, because each refresh rotates the refresh token, the login comes from outside the guest, and the user signs in again about every 30 days. And the answer “no” to the question from S14-claude-in-guestS14-claude-in-guest: Claude Code in the GuestHow Claude Code gets into the guest image, which of the user's Claude Code configuration goes with it, how it starts, and the agent interface that keeps Claude Code's specifics in one place (V1-02-claude-only).: refusing/v1/oauth/hellodoesn’t stop/loginfrom printing the authorize URL. - Controls touched: none weakened. SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential. holds for the measured mode: Claude Code had only placeholders. It wouldn’t hold for a login made in the guest, which the guest’s Claude Code stores in its Keychain, or in plaintext when there is none.
- Assumed or inferred:
- That a Pro or Max login behaves like the enterprise SSO login measured here, with the same scopes, lifetimes, and refresh.
- That a rotated-away refresh token still works after more than the five minutes measured. A short grace period looks the same.
- That
wbmay run the login with Claude Code’s public client ID. OpenShell holds back from this until Anthropic approves an OAuth client identity for third-party tools (X00-indexX00-index: SpikesThe open questions that must be answered by a throwaway prototype before work builds on them, in the order they are taken up.). - That the long-lived token didn’t reach the organization’s plugin and skill paths because of its scope. Inferred: it reached none of them on 2026-10-12, and the scope wasn’t logged then.
- Decisions: made on I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh? on 2026-10-15, as B15-browser-loginB15-browser-login: Can Claude Code in the guest run on a browser login while the host keeps the real tokens?Yes, with conditions.
recommended.
- The browser login isn’t in V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there.. The long-lived token stays the subscription mode, and I257I257 (open): Host-side browser login for the model credential (after V1)A host-side browser login for the model credential, deferred past V1 by the B15-browser-login decision on #15 (2026-10-15, option B not chosen for V1). keeps the measured design for later.
- The authorize URL gets no terminal filter. The warning in S14-claude-in-guestS14-claude-in-guest: Claude Code in the GuestHow Claude Code gets into the guest image, which of the user's Claude Code configuration goes with it, how it starts, and the agent interface that keeps Claude Code's specifics in one place (V1-02-claude-only). stays.
- Brief: B15-browser-loginB15-browser-login: Can Claude Code in the guest run on a browser login while the host keeps the real tokens?Yes, with conditions.
The long-lived token (I60, decided 2026-10-12)
Section titled “The long-lived token (I60, decided 2026-10-12)”- Decides: the answer for a long-lived subscription token, the host list for the model API profile, three questions about what Claude Code may reach besides the model, and whether the long-lived token becomes a supported mode. The spec changes wait for those decisions (I215I215 (closed): Model API profile and token binding from X01-model-credentialThe X01-model-credential result for a long-lived subscription token (#60, docs/spikes/X01-model-credential.md) changes the specs below.).
- You are approving: the answer “yes” for a long-lived token from
claude setup-token, given to Claude Code asCLAUDE_CODE_OAUTH_TOKEN. With a placeholder there and the proxy putting the real token intoAuthorization: Bearer,-p,-p --resumeand an interactive session answered. An interactive--resumeopened through the proxy, but nobody asked it a question. The real token was in no file of the test user’s home and in no Keychain item Claude Code made. API key mode wasn’t run, because the maintainer has no API key. The browser login and its refresh are still open in I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh?. - Controls touched: none weakened. SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential. holds
for this mode: the guest would hold only the placeholder.
SEC05-default-denySEC05-default-deny: Default-deny egress, enforced on the hostOnly allowlisted hostnames are reachable.: the profile can allow
api.anthropic.comalone for the model, and the run shows which other hosts Claude Code reaches without it. - Assumed or inferred:
- That a
setup-tokentoken lasts long enough that no refresh is needed in a session. The run didn’t see a refresh call. How long the token lasts wasn’t measured. - That API key mode works end to end, from OpenShell’s evidence
(X00-indexX00-index: SpikesThe open questions that must be answered by a throwaway prototype before work builds on them, in the order they are taken up.). The spike measured only that the placeholder goes out
as
x-api-keyand is replaced. - That the host’s own Claude Code and the guest’s don’t race, because
they hold different credentials. Inferred:
setup-tokenmakes a separate token, and nothing in the guest refreshes it. - That Claude Code’s switches for nonessential traffic stop the Datadog, event log, update, and changelog requests. The variables are in the binary, but the spike didn’t run with them set.
- That the placeholder went nowhere but
api.anthropic.com. The proxy looked for it only inAuthorizationandx-api-key, not in other headers, query strings or bodies, which is where 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., also looks for a leak. - That the main-loop and side calls to
/v1/messagesare what the host table says. Inferred from their timing andanthropic-betavalues.
- That a
- Open decisions: each has a recommendation in
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..
- Telemetry to Datadog, and Anthropic’s own event log on
api.anthropic.com, which receives the token. Recommended: Datadog stays outside the profile, as S07-egress-gatewayS07-egress-gateway: Egress GatewayThe only path from a guest to any network: a userspace network stack (wb-netd) and a policy-enforcing proxy (wb-proxyd) on the host. says today, and the guest turns telemetry off. Sub-choice: A1 keeps the event log path/api/event_logging/in the profile, and A2 leaves it out. With A2 the host enforces it. Recommended: A2./api/eval/stays in (recommended), or is left out the same way. - Updates from
downloads.claude.ai. Recommended: outside the profile, with the updater off in the guest. The image then sets the version. - The changelog from
raw.githubusercontent.com. Recommended: outside the profile. - Whether the long-lived token becomes a supported subscription
mode, with its unknown lifetime, its rotation when the host’s
secret store leaks, and its binding to
api.anthropic.comalone. Recommended: yes, for V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there., until I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh? settles the browser login.
- Telemetry to Datadog, and Anthropic’s own event log on
- Brief: 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.
Question
Section titled “Question”From X00-indexX00-index: SpikesThe open questions that must be answered by a throwaway prototype before work builds on them, in the order they are taken up.: does Claude Code work with a placeholder credential
while wb-proxyd injects the real one, for each supported
authentication mode, including token refresh? I60I60 (closed): X01-model-credential: API key mode via the proxySplit from #15 (X01-model-credential) during triage on 2026-10-04. asks it for the
modes that don’t need a browser: an API key, and, since the maintainer
signs in through enterprise SSO and has no API key, a long-lived token
from claude setup-token.
Answer
Section titled “Answer”Yes for the long-lived token. Claude Code 2.1.289 sends the
placeholder as Authorization: Bearer <placeholder>, only to
api.anthropic.com, with anthropic-beta: oauth-2025-04-20. The proxy
replaced the placeholder on all 36 requests that held it, and every
model call returned 200.
| Step | Result |
|---|---|
claude -p |
pong, is_error: false, 1.8 s |
claude -p --resume <session> |
I replied with "pong"., same session |
claude, interactive |
no key prompt. One question asked, and answered |
claude --resume <session>, interactive |
opened the session full screen. The maintainer left without a question, so no second answer was seen |
Measurements
Section titled “Measurements”The run was on 2026-10-12, on the host as the test user wbtest (I188I188 (closed): X01-model-credential: set up the test account and Keychain item for API key mode1.,
I214I214 (closed): X01-model-credential: run the API key spike as wbtestThe spike code is ready on spike/x01-model-credential (eed5dd0): a TLS-inspecting proxy that reads the key from wraithbox-secret and swaps it in for a placeholder, and run.sh, which runs -p, -p --resume, an…), with no VM. Claude Code 2.1.289 had
HTTPS_PROXY pointed at a throwaway Go proxy on 127.0.0.1 and
NODE_EXTRA_CA_CERTS naming the proxy’s CA, which only that process
trusted. The proxy read the token from the Keychain item
wraithbox-secret in wbtest’s login Keychain. The token and the
placeholder are both 108 characters. The proxy logged method, host,
path, header names and its verdict per request, never a value.
The proxy was set to inject the token on api.anthropic.com,
console.anthropic.com, platform.claude.com and claude.ai, to
learn which hosts take it. Only api.anthropic.com received it.
claude setup-token --help, run by the builder on the host as its own
user with the same Claude Code 2.1.289, prints “Set up a long-lived
authentication token (requires Claude subscription)”. It doesn’t give a
lifetime.
70 TLS connections, 72 requests. The proxy inspected the connections to all five hosts. Counts are requests.
| Host | Path | Requests | Token sent | Answer | What it is |
|---|---|---|---|---|---|
api.anthropic.com |
/v1/messages |
5 | yes | 200 | the model. Inferred from timing and anthropic-beta: 3 main-loop calls, one per answered prompt, and 2 side calls |
/api/event_logging/v2/batch |
10 | yes | 200 | Anthropic’s own telemetry | |
/api/eval/sdk-zAZezfDKGoZuXXKe |
4 | yes | 200 | feature flag evaluation (inferred from the path) | |
/api/claude_code/policy_limits |
5 | yes | 200, 304 | the organization’s limits | |
/api/claude_code/settings |
5 | yes | 404 | remote managed settings. None are set for this account | |
/api/claude_cli/bootstrap |
7 | yes | 403 | refused every time. Claude Code carried on | |
/mcp-registry/v0/servers |
16 | no | 200 | the public MCP server registry | |
/api/hello |
1 | no | 200 | a reachability check, interactive start | |
platform.claude.com |
/v1/oauth/hello |
1 | no | 200 | a reachability check of the login host, interactive start. No token was refreshed |
downloads.claude.ai |
/claude-code-releases/latest, then 2.1.296/manifest.json, manifest.zst.json, manifest.json.raw-sig.json, darwin-arm64/claude.zst |
10 | no | 200 | the auto-updater. It fetched the 2.1.296 build once in each interactive session |
/claude-code-releases/plugins/claude-plugins-official/latest, then one .zip |
2 | no | 200 | the official plugin marketplace | |
http-intake.logs.us5.datadoghq.com |
/api/v2/logs |
5 | no | 202 | Datadog log intake, with Claude Code’s built-in DD-API-KEY (X22-no-guest-credentialsX22-no-guest-credentials: Clients without guest credentialsWhich common clients (Homebrew against ghcr.io, git, gh, npm, pip, uv, SwiftPM, Go, cargo, Claude Code) break when wb-proxyd removes every guest-supplied Authorization header and cookie on inspected hosts?). The fifth was cut off when the run ended |
raw.githubusercontent.com |
/anthropics/claude-code/refs/heads/main/CHANGELOG.md |
1 | no | 200 | the changelog, shown at interactive start |
-p alone reached api.anthropic.com and Datadog. The updater,
the plugin marketplace, the changelog, and the two reachability checks
came only with an interactive session. The proxy didn’t see a cookie
in any request. It didn’t see the placeholder in the Authorization
or x-api-key header of a request to a host other than
api.anthropic.com. It didn’t look anywhere else in a request
(“Limits”).
What Claude Code stored
Section titled “What Claude Code stored”- Keychain: no item with
claudeoranthropicin its service or account name. With the token in the environment, Claude Code didn’t make a credential item. - Files:
~/.claude.json(51.4 KiB) and, under~/.claude/,settings.json,history.jsonl,policy-limits.json, an emptyremote-settings.json, and theprojects,sessions,plugins,backupsandcachedirectories. No.credentials.json. - The real token on disk: a fixed-string search of
wbtest’s home, skipping~/Library/Keychains, didn’t find a file holding it.
Neither search can be told apart from a failed one in this run. The
token went to grep -f through a pipe from security -w, and if that
had failed, grep would have had no pattern and wouldn’t have matched anything. The
Keychain listing hid the errors of security dump-keychain. The proxy
read the same item at start, which makes a failed read unlikely, but
the run didn’t check it. run.sh now fails in both cases (commits
2a83a3a and 2801f5f).
First run
Section titled “First run”An earlier run in API key mode found a bug in the spike proxy, not in
Claude Code. The proxy wrote HTTP/2 status lines to its HTTP/1.1
client, and Claude Code failed with Malformed_HTTP_Response. It did
show that Claude Code sends a placeholder ANTHROPIC_API_KEY as
x-api-key to api.anthropic.com, and the proxy replaced it there.
The item didn’t hold an API key, so /v1/messages answered 401.
Limits
Section titled “Limits”- One run, on one Mac, with one account, with about a minute of traffic. The interactive sessions asked one question between them.
- The token’s lifetime and a refresh weren’t seen. The browser login wasn’t tried (I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh?).
- Bodies weren’t logged, so what the telemetry requests hold is unknown.
- The disk search covered
wbtest’s home only, not/tmpor/var/folders. It searched for the real token, not the placeholder, and didn’t check that the token was read (“What Claude Code stored”). - The proxy looked for the placeholder in
Authorizationandx-api-keyonly. A scan of every header, the query string, and the body, as 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., does, is still to do, in the next run with the maintainer or in the conformance tests ofwb-proxyd. - The run was on the host, not in a guest, and nothing denied a host: what Claude Code does when Datadog, the updater, or the changelog is unreachable wasn’t measured.
/api/claude_cli/bootstraprefused this token every time. Why wasn’t checked: the run doesn’t show whether another kind of credential gets 200 there.
What it means for the specs
Section titled “What it means for the specs”The pull request with this result didn’t change them. The maintainer decided the open points on I60I60 (closed): X01-model-credential: API key mode via the proxySplit from #15 (X01-model-credential) during triage on 2026-10-04. on 2026-10-12, and I215I215 (closed): Model API profile and token binding from X01-model-credentialThe X01-model-credential result for a long-lived subscription token (#60, docs/spikes/X01-model-credential.md) changes the specs below. made these changes:
- 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” profile:
api.anthropic.comwith the paths above except the event log, andplatform.claude.com/v1/oauth/hello./api/event_logging/is a built-in deny. Datadog,downloads.claude.aiandraw.githubusercontent.comare outside the profile. “Named places” gainsAuthorizationfor the model API, which every inspected host already removes. The binding injectsAuthorization: Bearer <token>for a token, orx-api-keyfor an API key, on the four paths ofapi.anthropic.comwhere Claude Code sent the token. - 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”: the long-lived
token is a supported mode in V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there.. The placeholder goes in
CLAUDE_CODE_OAUTH_TOKEN, and the text says how the user revokes and replaces the token. - 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”: the guest sets
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1andDISABLE_UPDATES=1, and the image sets the Claude Code version. A new version needs a cheap image rebuild (I220I220 (closed): Cheap image rebuild for a new Claude Code version- Which stage a Claude Code-only rebuild starts from (a sealed earlier stage, a clone of the image before sealing, or another layer), and how that fits sealing and "never updated in place".), and marketplace plugins are unavailable in V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there.. - FR01-drop-inFR01-drop-in: Drop-in for claudewb is the single entry point for everything, structured as wb [wb flags] <command> [command args]. names those V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there. gaps: the updater, the changelog notice and marketplace plugins are missing in the guest.
- S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them., “Out of scope”: the browser login (I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh?), in place of the subscription login.
- S11-verification-and-spikesS11-verification-and-spikesthe filter's fuzz properties, including one that replays the filtered output and the exit reset into a headless emulator and checks it is back in its initial state, and a conformance case that prints every dropped seq…: X01-model-credentialX01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh? in its list of result pages. New conformance cases cover the full-request placeholder scan, the event log deny, and a run of Claude Code with the left-out hosts refused.
Browser login (I15)
Section titled “Browser login (I15)”The run on 2026-10-15, with the maintainer, answers the rest of I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh? except API key mode, which moved to I253I253 (open): X01-model-credential: API key mode end to end via the proxyDoes Claude Code work end to end in API key mode with a placeholder API key while wb-proxyd injects the real key in x-api-key? because there is no key to run it with.
Answer (I15)
Section titled “Answer (I15)”Yes, with conditions. Claude Code 2.1.296 works on a browser login
when its store holds placeholder access and refresh tokens and a
host-side proxy holds the real pair. The proxy put the real access
token into Authorization: Bearer, and answered Claude Code’s refresh
itself, so the real refresh token never reached Claude Code.
| Step | Result |
|---|---|
claude -p, store expired |
refreshed first, then pong, is_error: false |
claude -p --resume <session>, store expired again |
refreshed with the refresh token the proxy got back, then I replied with "pong". |
claude, interactive |
one question asked, and answered |
The conditions:
- Only the host refreshes. Every refresh returned a new refresh token. With a second holder of the same login, each would have to learn the other’s new token.
- The login comes from outside the guest. In the run it came from
a real
/loginon the host’s test user, moved out of Claude Code’s store by the spike’sswap. - A login lasts about 30 days. A refresh doesn’t move the refresh token’s deadline. The user signs in again when it passes.
For the question from S14-claude-in-guestS14-claude-in-guest: Claude Code in the GuestHow Claude Code gets into the guest image, which of the user's Claude Code configuration goes with it, how it starts, and the agent interface that keeps Claude Code's specifics in one place (V1-02-claude-only).: no, refusing
/v1/oauth/hello doesn’t stop the login prompt. Claude Code builds
the authorize URL, with its PKCE challenge, without a request.
Run (I15)
Section titled “Run (I15)”On the host as wbtest, in a su - wbtest terminal, with Claude Code
2.1.296 and the spike proxy set up as on 2026-10-12. login.sh ran
five steps: deny, observe, placeholder, restore and
nokeychain, then a /logout through the proxy. The maintainer
signed in with the enterprise SSO account that made the long-lived
token of 2026-10-12.
The proxy logged hosts and paths. On a path holding oauth or token
it logged the body’s field names, with values only for fields that
aren’t secret (grant_type, client_id, scope, expires_in and the
like), and string lengths for the rest. It scanned every header, the
query and the body of every request for the two placeholders.
The first deny and observe runs are void. login.sh set its
EXIT trap inside a function, and zsh runs such a trap when the
function returns, so the proxy stopped before Claude Code started.
Claude Code met a closed port, and the login failed. Commit 7f2d9a1
fixed it, and both steps ran again.
The login
Section titled “The login”| What | Measured |
|---|---|
| Authorize | https://claude.com/cai/oauth/authorize, with code=true, response_type=code, redirect_uri=https://platform.claude.com/oauth/code/callback, an S256 PKCE challenge, state, and the public client ID 9d1c250a-e61b-44d9-88ed-5944d1962f5e. The browser shows a code, which the user pastes into Claude Code |
| Scopes | asked: org:create_api_key, user:profile, user:inference, user:sessions:claude_code, user:mcp_servers, user:file_upload, user:plugins. Granted: all but org:create_api_key |
| Reachability check | GET platform.claude.com/v1/oauth/hello, 200, after the code was pasted and before the exchange. Seen in one of the two logins (nokeychain) |
| Exchange | POST platform.claude.com/v1/oauth/token, a JSON body: grant_type=authorization_code, code (48 characters), code_verifier (43), state (43), client_id and redirect_uri. No client secret |
| Tokens | 200: access_token (108 characters), expires_in=28800 (8 hours), refresh_token (108), refresh_token_expires_in (below), scope, token_type=Bearer, token_uuid, and account and organization objects |
| After the login | GET on api.anthropic.com, with the token: /api/oauth/profile, /api/oauth/claude_cli/roles and /api/organization/claude_code_first_token_date |
| Stored in | the login Keychain, item Claude Code-credentials: one JSON value whose field claudeAiOauth holds accessToken, refreshToken, expiresAt (milliseconds), scopes, subscriptionType (enterprise), rateLimitTier and an empty refreshTokenExpiresAt. No .credentials.json |
Refresh
Section titled “Refresh”x01-proxy swap moved the real pair into the Keychain item
wraithbox-oauth, and wrote placeholders of the same length into
Claude Code’s item, with expiresAt an hour in the past.
- Request. Claude Code refreshed before its first model call:
POST platform.claude.com/v1/oauth/token, a JSON body withgrant_type=refresh_token,refresh_token,client_id, andscopeset to the granted list. No client secret. - Swap. The proxy put the real refresh token into the body, and
the placeholders into the answer in place of the new real tokens.
Claude Code then stored the placeholders with
expiresAt8 hours ahead. - Rotation. Both refreshes answered 200, with a new access token
and a new refresh token each time, and
expires_in=28800. - Fixed deadline.
refresh_token_expires_infell with the clock across both refreshes and the restore: 2,472,894 s at 19:42, 2,472,627 at 19:47 and 2,472,374 at 19:51. The deadline is set at login. A new login at 19:54 got 2,579,568 s, about 29.9 days. - Old refresh tokens still work. The proxy failed to save the
rotated pairs (
security add-generic-password -Uexited 45, a spike bug fixed in5dabd68), so its item kept the first pair. The restore step put that pair back, and Claude Code refreshed with the first refresh token at 19:51, about five minutes after it had been rotated twice: 200. Rotation doesn’t revoke the old refresh token, at least not within five minutes.
Placeholders and the real tokens
Section titled “Placeholders and the real tokens”- The scan found a placeholder in one place only: the body of the
refresh request to
platform.claude.com, where the proxy swaps it. No other header, query string, or body had one. - The proxy checks each token answer for a real token it holds before the answer goes to Claude Code, and found none.
- A fixed-string search of
wbtest’s home for the first real pair, outside~/Library/Keychains, didn’t find a file. The pairs from the two refreshes were in the proxy’s memory only and weren’t searched for.
Organization plugins and skills
Section titled “Organization plugins and skills”With the browser login, Claude Code also reached these paths on
api.anthropic.com, with the token:
/api/oauth/organizations/<org>/marketplaces, plugins/list-plugins,
plugins/<id>/download, skills/list-skills and
skills/<name>/download. It downloaded nine skills and one plugin of
the maintainer’s organization, as zip files of 5 to 173 KB, into
~/.claude/skills and ~/.claude/plugins. The long-lived token of
2026-10-12 reached none of these paths.
Without a Keychain
Section titled “Without a Keychain”In the su terminal with the login Keychain locked, /login worked,
and Claude Code wrote the login in plaintext to
~/.claude/.credentials.json (mode 0600, 528 bytes), without a
message. With the Keychain unlocked again, Claude Code still read the
file, and /logout deleted it.
The authorize URL without a network
Section titled “The authorize URL without a network”Logged out, with the proxy refusing all of platform.claude.com,
claude.ai and console.anthropic.com, /login printed the
authorize URL. The proxy saw 23 connections in that session, to
api.anthropic.com, downloads.claude.ai and Datadog, and none to a
refused host, so it refused no request.
Logout
Section titled “Logout”/logout sent POST platform.claude.com/v1/oauth/token/revoke, a
JSON body with token (108 characters), token_type_hint (13, the
length of refresh_token) and client_id. It answered 200 with an
empty body. Claude Code then deleted its store and exited. Whether
revoking the newest refresh token also revokes the older ones of the
same login wasn’t tested.
The billing banner
Section titled “The billing banner”With the restored login, and with the login read from
.credentials.json, the banner said “API Usage Billing” where it
otherwise said “Claude Enterprise”. The model answered either way.
Why wasn’t checked.
Limits (I15)
Section titled “Limits (I15)”- One enterprise SSO account, one Mac, one run, Claude Code 2.1.296. A Pro or Max login may differ in scopes, lifetimes, and paths.
- On the host, not in a guest.
- One check of an old refresh token, five minutes after the rotation.
- Claude Code refreshed when
expiresAthad passed. Whether it also refreshes on a 401, or never does whenexpiresAtlies far ahead, wasn’t tested. /v1/oauth/helloshowed in one login of two.- The tokens from the two refreshes stayed in the proxy’s memory, weren’t searched for on disk and weren’t revoked by name.
What it means for the specs (I15)
Section titled “What it means for the specs (I15)”The pull request with this result doesn’t change them. The maintainer decided on I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh? on 2026-10-15: the browser login isn’t in V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there. (I257I257 (open): Host-side browser login for the model credential (after V1)A host-side browser login for the model credential, deferred past V1 by the B15-browser-login decision on #15 (2026-10-15, option B not chosen for V1). keeps the design), and the authorize URL gets no filter. I256I256 (closed): S14-claude-in-guest, S09-policy-credentials-audit: browser login decisions from B15-browser-loginSpec changes from the B15-browser-login decisions on #15 (2026-10-15). makes these changes:
- S14-04-commands-and-endpointsS14-04-commands-and-endpoints: Commands and EndpointsWhich permission mode Claude Code runs in, the commands that don't work in a guest, the guest instructions that explain the guest's limits to Claude Code, and the endpoints Claude Code in the guest may reach., “Commands that don’t fit a guest”: the answer
to its measurement, the authorize host
claude.com, and that a guest’s login fails at the exchange, not before the URL. - 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”: API key mode is open in I253I253 (open): X01-model-credential: API key mode end to end via the proxyDoes Claude Code work end to end in API key mode with a placeholder API key while wb-proxyd injects the real key in x-api-key?, and the browser login isn’t a V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there. mode.
- S15-least-privilegeS15-least-privilege: Least Privilege on the HostThe security design for SEC12-least-privilege: which rights Wraith Box takes on the host, where credentials are held, and how each host process gets only the credentials it needs, for only as long as it needs them., “Out of scope”: the browser login points to I257I257 (open): Host-side browser login for the model credential (after V1)A host-side browser login for the model credential, deferred past V1 by the B15-browser-login decision on #15 (2026-10-15, option B not chosen for V1)..
- X00-indexX00-index: SpikesThe open questions that must be answered by a throwaway prototype before work builds on them, in the order they are taken up.: the I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh? answer.
Spike code
Section titled “Spike code”Branch spike/x01-model-credential, commit
2801f5f:
the proxy, its tests, and run.sh. The run on 2026-10-12 used
run.sh as of 768cc28, before the search checks. The logs stay on the maintainer’s
Mac. They don’t hold a credential.
For I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh?, commit
5dabd68:
login.sh, and the proxy’s deny rules, field logging, full-request
scan, OAuth store and swap. The runs on 2026-10-15 used the proxy
as of e499d3b and login.sh as of 7f2d9a1, and the restore step
as of 5dabd68. Their logs stay on the maintainer’s Mac and don’t
hold a token.
Status: Answered 2026-10-12: yes for a long-lived token. Decided 2026-10-12 (I60I60 (closed): X01-model-credential: API key mode via the proxySplit from #15 (X01-model-credential) during triage on 2026-10-04.): A2, the model only with the event log denied by the host, and the long-lived token as a supported mode for V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there.. Answered 2026-10-15 (I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh?): yes, with conditions, for the browser login. Decided 2026-10-15 (I15I15 (closed): X01-model-credential: Model credential via the proxyDoes Claude Code work with a placeholder credential while wb-proxyd injects the real one, for each supported authentication mode, including token refresh?): not in V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there., and no filter for the authorize URL