S09-05 - Credentials
Purpose: How credentials are stored and bound to requests, and how the model credential reaches the model API without entering the guest.
Design
Section titled “Design”Storage
Section titled “Storage”Each credential is an item in the platform’s secret store (S12-platformsS12-platforms: PlatformsWhich host and guest operating systems Wraith Box targets, how platform-specific code is isolated, what each platform uses, and how wb works inside WSL.). Only the processes that 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. declares for it read it:
wb-proxydfetches bindings;wb-credset, whichwb credruns, writes, lists and deletes them.
wb itself doesn’t have store access.
Other platforms scope items as narrowly as their store allows. The limits are documented per platform in S12-platformsS12-platforms: PlatformsWhich host and guest operating systems Wraith Box targets, how platform-specific code is isolated, what each platform uses, and how wb works inside WSL..
On macOS
Section titled “On macOS”A credential is an item in the data protection keychain, in the access
group <TEAMID>.nl.wraithbox.binding of the team that signed the
build.
wb-credset and wb-proxyd both hold that group. So the Keychain
would let wb-credset read a binding too. Our code is what keeps it
from fetching one (S15-02-secret-storeS15-02-secret-store: The Secret StoreWhere credentials are held: the secret store, its backends, and the guarantees a backend must give., “Keychain”).
Signing:
- Release builds are signed with Wraith Box’s Developer ID.
- Development builds are signed with the developer’s own Apple Development certificate and team. A rebuild keeps reading the items with no dialog (X29-dev-signingX29-dev-signing: Keychain access group for development buildsCan a developer's free personal team, an Apple ID signed in to Xcode without a paid membership, sign the helpers in Wraith Box.app (wb-proxyd, wb-hostd, wb-vmd) with a keychain-access-groups entitlement and a provisio…). In a development build, any other program the developer’s team signs can claim the group, which 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. documents.
- An ad-hoc signed build has no Keychain backend.
wb setuprefuses it with the rulekeychain-needs-team, and says how to sign the build. V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there. has no other backend (S15-02-secret-storeS15-02-secret-store: The Secret StoreWhere credentials are held: the secret store, its backends, and the guarantees a backend must give., “1Password”).
Bindings
Section titled “Bindings”A binding names:
- the hosts, ports and paths it applies to;
- the header and scheme to inject;
- the secret store item.
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. covers placeholders found elsewhere.
Besides static values, a binding can hold:
- an OAuth 2 refresh token or client credentials, which
wb-proxydexchanges for short-lived access tokens; - AWS keys, for SigV4 signing.
wb cred set <binding> reads the value from a prompt or stdin. The
value never appears in arguments or logs.
Public values
Section titled “Public values”A binding can also hold a fixed public value in place of a secret store
item. That is for a host that answers public reads only to a request
with a token. Built-in profiles ship these, such as the anonymous
ghcr.io token for Homebrew bottles (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.,
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?).
Such a value isn’t a secret, and the guest doesn’t get a placeholder for it.
Built-in hosts
Section titled “Built-in hosts”A binding on a host that a built-in profile covers applies only to the hosts and paths of the profile’s parts that are on (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., “Profile parts”).
A project’s binding is injected for requests from the whole VM while the project has a session in it. So any process in that VM can have it used on its behalf, though none can read it (T11-shared-vm-grantsT11-shared-vm-grants: Projects in one VM share network grantsThe host sees one guest address per VM, and can't tell which project user, session or program opened a connection.).
wb policy explain shows who can reach it (S09-02-precedenceS09-02-precedence: PrecedenceHow the policy sources merge, how the mode of each host and port resolves, and how the merge works for a VM with more than one project.).
Model credential
Section titled “Model credential”Claude Code in the guest is configured with a placeholder. The model
API profile’s binding injects the real credential on
api.anthropic.com alone (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., “Named places”).
The kind of credential stored for the binding decides both:
- the guest variable that holds the placeholder;
- the header the binding injects.
Placeholder form
Section titled “Placeholder form”Each VM gets its own placeholder for the model credential.
Made by wb-proxyd
Section titled “Made by wb-proxyd”wb-proxyd generates the placeholder when it first fetches the binding
for a VM. It is the only process that reads the binding
(S15-03-access-rulesS15-03-access-rules: Access RulesHow each host process gets only the credentials it needs, for only as long as it needs them, and which process may access which item., “Declared access”). It sends wb-hostd only the
placeholder, in a placeholder record.
wb-hostd keeps the VM’s placeholder set, every placeholder of each
binding, with the VM’s state. It:
- puts the newest in the guest environment;
- hands the whole set back to
wb-proxydafter a suspend or a restart (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”, and S04-07-supervisionS04-07-supervision: SupervisionWho starts and restarts each host process, what happens when wb-hostd stops or the bundle is upgraded, and daemon outages., “Restarting a daemon”).
wb-proxyd drops the binding at suspend as before. It doesn’t keep
placeholder state of its own past it.
Checked when handed back
Section titled “Checked when handed back”A handed-back placeholder is only a string to scan for, because
injection never depends on it. But wb-proxyd checks it before it
scans for it:
- its form: letters, digits and
-only, 32 to 256 characters (a cap fixed in code). It is either random throughout, or the fixed prefix (“Shape”) followed by at least 32 random characters; - neither it nor any of the VM’s binding credentials is a substring of
the other. That is checked when
wb-proxydhas the binding; - at most 8 placeholders per binding per VM. The oldest is dropped past that.
A placeholder that fails a check is discarded. wb-proxyd then:
- draws a fresh one;
- sends
wb-hostdits record; - logs a Device Config State Change (5019) event that names the VM
and the binding, with the rule
placeholder-invalid(SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.).
Random
Section titled “Random”The random part comes from the OS’s cryptographic random source (S15-03-access-rulesS15-03-access-rules: Access RulesHow each host process gets only the credentials it needs, for only as long as it needs them, and which process may access which item., rule 8). It is independent of the credential. It has at least 32 letters and digits, even when the stored credential is shorter.
The placeholder has the stored credential’s length, or more when the random part needs it. It has at most 256 characters.
It keeps the credential’s prefix only when the prefix matches a pattern
fixed in code: sk-ant-, then 1 to 8 lowercase letters or digits, then
-. The placeholder then looks like the credential to Claude Code.
Any other credential gets a placeholder that is random throughout.
Never reused, by chance
Section titled “Never reused, by chance”Every record of a placeholder is deleted with its VM.
A random part of at least 32 letters and digits holds about 190 bits. So two VMs drawing the same placeholder, or one drawing an earlier one, won’t happen in practice.
wb cred set with a new value gives the VM a new placeholder for its
next session. The old one stays in the VM’s scan set for the rest of
that VM’s lifetime, up to the cap of 8. It goes with the VM’s state
when the VM is deleted.
What this gives
Section titled “What this gives”Ordinary text then can’t match a placeholder by chance. A placeholder seen in a refusal names its VM (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.).
Credential kinds
Section titled “Credential kinds”Long-lived token
Section titled “Long-lived token”A Claude subscription user runs claude setup-token on the host, and
stores the token it prints with wb cred set.
- The guest’s placeholder goes in
CLAUDE_CODE_OAUTH_TOKEN. - The binding injects
Authorization: Bearer <token>.
claude setup-token says the token is valid for one year. Nothing in
Wraith Box renews it. At expiry, or after a leak, the user:
- revokes the token at claude.ai/settings/claude-code, under “Authorization tokens”;
- runs
claude setup-tokenon the host again; - stores the new token with
wb cred set.
API key
Section titled “API key”- The guest’s placeholder goes in
ANTHROPIC_API_KEY. - The binding injects
x-api-key.
OpenShell has shown that an API key works this way.
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? saw the placeholder go out as x-api-key and be
replaced.
Browser login
Section titled “Browser login”Browser login is not a V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there. mode. The subscription login through a
browser (/login, SSO) and its token refresh need two things
(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?, “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?)”):
- the login happens outside the guest;
- only the host refreshes.
The host-side login is in 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).. A guest’s own login fails at the code exchange (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”).
Never in the guest
Section titled “Never in the guest”Images are scanned for secrets at seal time. The environment of every guest process is built from an allowlist.
Decisions
Section titled “Decisions”wb has no store access
Section titled “wb has no store access”Ad-hoc signed builds get no Keychain backend
Section titled “Ad-hoc signed builds get no Keychain backend”- Decided: I248I248 (closed): X29-dev-signing: Keychain access group for development builds signed by a personal teamCan a developer's free personal team (an Apple ID signed in to Xcode, no paid membership) sign the helper binaries inside Wraith Box.app (wb-proxyd, wb-hostd, wb-vmd) with a keychain-access-groups entitlement and a… (B248-dev-signingB248-dev-signing: Can development builds signed by the developer's own team share Keychain items across an update?Yes, with conditions.).
A placeholder per VM, made by wb-proxyd
Section titled “A placeholder per VM, made by wb-proxyd”The long-lived token is a V1 mode
Section titled “The long-lived token is a V1 mode”- Decided: I60I60 (closed): X01-model-credential: API key mode via the proxySplit from #15 (X01-model-credential) during triage on 2026-10-04. (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.).
No browser login in V1
Section titled “No browser login in V1”- Decided: 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? (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.).
Status: Draft