Skip to content

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.

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-proxyd fetches bindings;
  • wb-credset, which wb cred runs, 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..

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:

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-proxyd exchanges 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.

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.

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.).

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.

Each VM gets its own placeholder for the model credential.

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:

wb-proxyd drops the binding at suspend as before. It doesn’t keep placeholder state of its own past it.

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-proxyd has 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:

  1. draws a fresh one;
  2. sends wb-hostd its record;
  3. 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.).

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.

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.

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.).

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>.

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? measured this mode.

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:

  1. revokes the token at claude.ai/settings/claude-code, under “Authorization tokens”;
  2. runs claude setup-token on the host again;
  3. stores the new token with wb cred set.
  • 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 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”).

Images are scanned for secrets at seal time. The environment of every guest process is built from an allowlist.

Ad-hoc signed builds get no Keychain backend

Section titled “Ad-hoc signed builds get no Keychain backend”

Status: Draft