S07-08 - Requests and Credentials
Purpose: The form of each request wb-proxyd sends upstream, and
how it removes the guest’s credentials and injects bound ones.
Design
Section titled “Design”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. says where a placeholder may go. S07-10-anonymous-credentialsS07-10-anonymous-credentials: Anonymous CredentialsHow wb-proxyd answers hosts that want a token even for public reads, without forwarding the guest's token. covers hosts that want a token for public reads.
Request form
Section titled “Request form”On inspected hosts, wb-proxyd parses each request. It sends upstream
a request it builds itself:
- in origin form: the path and query, with any userinfo of an absolute-form target dropped;
- with no trailers;
- with no hop-by-hop field (
Connection,Keep-Alive,TE,Upgradeand the others of RFC 9110, section 7.6.1) and no field aConnectionnames, and with the framing the body goes upstream in; - with no
Expect:wb-proxydanswersExpect: 100-continueitself once the request passed its steps; - with a
Hostor:authoritythat must equal the stream’s hostname, or the request is refused.
The Host, and the host of an absolute-form target, equal the
stream’s hostname compared without ASCII case. The only port either
may name is the stream’s own, so Host: example.com:443 passes on
port 443. A request is refused with a 400 and the rule
http-request-form when its head isn’t in the form of RFC 9112, or its
Host or target host differs from the stream’s. A field name with an
_ is refused the same way, since some servers read it as a - and
a credential header could get past the removal step that way
(SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential.). The head parser is
strict: each form it refuses is listed in code, and none reaches a
library that would normalize the request first.
Policy, bindings and the credential rules match on the canonical path.
That path is also the one sent upstream. Literal dot segments are
removed. As in OpenShell v0.1.2, repeated slashes are collapsed into
one. A percent-escape of a letter, a digit or another byte that may
appear literally in a segment is decoded. Every other escape is
written with uppercase hexadecimal digits. ; parameters stay in
the path.
A request is refused, with the rule http-path-form, if its path has:
- a control byte or a backslash;
- a raw byte that isn’t ASCII, a
#, or a?left in the path; - malformed percent-encoding (
%zz, a lone%); - a
..segment above the root; - a segment whose percent-decoded value, split on
/, has a.or..component (%2e%2e,wget%2F..%2Fcurl,wget%2F%2e%2e%2Fcurl), or such a component before a;(..;); - more than 8 KiB, as received or in canonical form.
Path patterns in policy are put in the same canonical form before
they match, so /%67raphql in a rule matches what /graphql does.
Encoded slashes
Section titled “Encoded slashes”An encoded / is data inside its segment, never a separator. Rules
match it that way, and it goes upstream encoded, as %2F.
- npm’s scoped
/@scope%2fnameand GitLab’s/api/v4/projects/group%2Fprojectmatch their rules as one segment. ghcr.io/v2/homebrew%2Fcore/...matches nohomebrew/corerule. It is refused by default-deny.
Some hosts decode %2F before routing, and ghcr.io is one of them.
On such a host, profile authors shape rules by path prefix and method
only. A rule that allows a wildcard segment and denies a sibling path
under it isn’t sound there. The host can route an encoded / to that
sibling.
GitHub, GitLab, Codeberg, npm and PyPI treat %2F as data. So a deny
under an allowed prefix holds on them, such as the git hosting
profile’s archive deny.
Header cap
Section titled “Header cap”This cap serves SEC13-bounded-resourcesSEC13-bounded-resources: Bounded resourcesCPU, memory and disk of each VM are capped.. The request head is capped at 64 KiB, fixed in code. The head is the request line and header bytes over HTTP/1.1, or the decoded header list over HTTP/2.
- Over HTTP/2,
wb-proxydannounces the cap asSETTINGS_MAX_HEADER_LIST_SIZE. - A request over the cap gets a
431with the rulehttp-header-size. Nothing goes upstream.
Transfer coding
Section titled “Transfer coding”On every inspected host, a request is refused on its headers with a
400 and the rule http-transfer-coding when:
- its
Transfer-Encodingis anything but onechunked; - it has a
Transfer-Encodingover HTTP/2; - it has both
Transfer-EncodingandContent-Length.
Such a request doesn’t reach the upstream.
A chunked body whose framing fails to decode ends the request with the
same rule. wb-proxyd aborts the upstream request as for a
placeholder in the body (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”).
Order of the steps
Section titled “Order of the steps”Each request then goes through these steps in order:
- canonicalize;
- classify and remove guest credentials (audited);
- the checks on the request head:
http-transfer-coding, the placeholder scan of the target and the remaining headers, andmodel-content-encoding; - HTTP policy;
- the dependency gate;
- credential injection;
- the streaming placeholder scan of the body, as it goes upstream.
A request stops at the first step that refuses it. Step 3 runs its checks in the order listed, and refuses with the rule of the first one that fails.
Credential removal and HTTP policy can’t be skipped. When either step
isn’t in place, every request is refused with a 500 and the rule
http-step-missing, so no wiring mistake sends a request upstream
with the guest’s credentials or without HTTP policy. The other steps
only add checks or credentials.
Before step 1, the method-override check of S07-16-tls-and-tunnelsS07-16-tls-and-tunnels: TLS and TunnelsWhat wb-proxyd does with client certificates, encrypted ClientHello and tunnels, and which refusals no mode or approval relaxes.,
“Method overrides”, runs again, so a request from any reader of the
head is refused with http-method-override.
Credential replacement
Section titled “Credential replacement”This section serves SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential..
Headers
Section titled “Headers”wb-proxyd removes the credentials the guest sends, whatever the
method:
Authorization,Proxy-AuthorizationandCookieon every inspected host;- each header the host’s built-in profile names.
Cookie goes even when the server itself set the cookie. So a host
whose flow needs cookies fails until a built-in profile for it allows
them. Examples are a challenge page, or a download behind a session
redirect.
Parameters
Section titled “Parameters”A request with a credential parameter that the profile names is
refused with a 403 that names the rule. The parameter counts:
- in the query string;
- in a form-encoded body;
- in a part of a
multipart/form-databody; - as a top-level key of a JSON body.
The media type is matched case-insensitively, with its parameters
ignored. So APPLICATION/JSON; charset=utf-8 is scanned.
Bodies are read for this up to a fixed number of bytes received,
whatever Content-Length says. On a host whose profile names
parameters, a larger body of those types is refused, and so is one
that fails to parse.
Names are compared after percent-decoding and JSON string decoding,
with the profile’s case rule. A repeated or empty occurrence counts,
and so does the name followed by [ (private_token[]).
Injection and findings
Section titled “Injection and findings”If the host has a credential binding, the binding’s credential is then injected (S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded.).
- A guest token in any of those places is never forwarded.
wb-proxyddoesn’t look for credentials in other places (T10-unnamed-credentialsT10-unnamed-credentials: Guest credentials in unnamed placeswb-proxyd removes Authorization, Proxy-Authorization and Cookie on every inspected host.).- Each removal and refusal is logged with the header or parameter name and the rule, never the value (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.).
A removed value can be neither a placeholder the guest was given nor the binding’s fixed public value. That means the guest holds a credential from somewhere else. It is a detection finding (S09-policy-credentials-auditS09-policy-credentials-audit: Policy, Credentials, Certificates and AuditWhere policy comes from, how secrets are held, how TLS inspection is trusted, and what is recorded.), with the scheme and the header or parameter name. Findings are rate-limited per VM.
Git LFS isn’t in the git hosting profile (S08-workspace-and-gitS08-workspace-and-git: Workspace and Git Round TripHow code gets into the guest and how the agent's work gets back out, without sharing the host filesystem., “Out
of scope”). On a host the user allows for it, LFS hands the client a
server-issued Authorization header for each object. An LFS clone
there raises these findings too.
Credential headers in responses
Section titled “Credential headers in responses”On an inspected host with a credential binding, wb-proxyd removes
these headers from the response before it reaches the guest:
- Every
Set-Cookie. A session cookie that a server issues to a request with the injected credential is a secret derived from it. SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential. keeps that out of the guest. X-OAuth-Scopes,X-Accepted-OAuth-ScopesandX-OAuth-Client-Id, which describe the injected credential.
Each removal is logged with the header’s name, never the value
(SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.). For a cookie the log also names the cookie. The rule is
set-cookie-bound-host for cookies, and
credential-header-bound-host for the others.
Named places
Section titled “Named places”The model API profile names Authorization and x-api-key. Its
binding injects the model credential on api.anthropic.com alone.
There it injects only on the paths where 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
Claude Code send it:
/v1/messages;/api/claude_code/;/api/claude_cli/bootstrap;/api/eval/.
A long-lived token from claude setup-token is injected only as
Authorization: Bearer <token>. An API key is injected only as
x-api-key (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 git hosting profile names, per kind of 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?):
| Kind | Headers | Parameters |
|---|---|---|
| GitHub | Authorization only. GitHub itself refuses ?access_token=. |
none |
| GitLab | PRIVATE-TOKEN, JOB-TOKEN, Deploy-Token |
private_token, access_token, job_token, bearer_token, compared case-sensitively, as GitLab does |
| Gitea and Forgejo | none | token, access_token, compared case-sensitively |
github.com, gitlab.com and codeberg.org get their kind built in.
A git remote on any other host gets the git hosting profile when the host repository’s remotes name it. Until the user sets its kind in policy, it gets the union of every kind’s names. A self-hosted host then fails closed.
Signed URLs
Section titled “Signed URLs”wb-proxyd passes a credential in any other parameter unchanged.
The presigned storage URLs of Homebrew bottles need that, and so do
those of git LFS on a host the user allows.
wb-proxyd can’t tell who signed such a URL. The guest can sign one
for its own bucket. A storage host still has to be allowed by policy.
The approval risk check flags:
- a shared object-storage host, such as
*.s3.amazonaws.com,storage.googleapis.comor*.blob.core.windows.net; - a wildcard over one;
- a rule that allows signature parameters on a write method.
Decisions
Section titled “Decisions”Remove guest credentials on every inspected host
Section titled “Remove guest credentials on every inspected host”wb-proxyd removes Authorization, Proxy-Authorization, Cookie
and the profile’s named headers, refuses named parameters, and injects
only the binding’s credential.
- Decided: I33I33 (closed): X22-no-guest-credentials: Clients without guest credentialsX22-no-guest-credentials (added to S11-verification-and-spikes in #14) (B33-no-guest-credentialsB33-no-guest-credentials: Can the proxy drop every credential the guest sends without breaking its tools?Yes, with conditions.).
Status: Draft