v0.6 design round scoping — credential brokerage
Status: implemented 2026-12-01 — fork A (cooperative plaintext) as recommended here. See usage.md for the shipped grammar and recipes. The implementation notes below are updated where reality deviated from the scoping; the rest of the document is preserved as the design-round input for the record.
Implementation deviations from the scoping, honestly recorded:
- the grammar grew a static prefix:
HOST:HEADER=[PREFIX]env:VAR— required because git smart-HTTP accepts only HTTP Basic (Basic env:B64) while APIs wantBearer/x-api-keyschemes - keep-alive had to be force-disabled on injected connections: injection happens once per connection at connect time, and git pipelines — the POST after an authenticated GET flowed raw and unauthenticated. Connection: close makes every request a fresh injected connection
- TLS teardown needed fd-shutdown-then-collect ordering: tls_close frees the SSL object under a blocked reader (segfault), and a naive drain outlived the process-exit grace, losing evidence records entirely
The measured problem
Evidence, not theory (spikes/agentic-git/VERDICT.md):
- scoped egress cannot contain an in-jail credential. The failure is not exfiltration to a third host — it is that the credential is omnipotent on the one host the workflow must allow. A token injected for one throwaway repo read every other repo of its owner from inside the jail, never leaving the egress policy.
- every agentic write-side workflow needs this shape: git push, LLM API calls, package registry publish. The read side of the adoption story is done; this is the only hole between cell and the full use case.
CONNECTis TLS-opaque by design. Metering works; injection is impossible. Any design that injects must do so on traffic that is not CONNECT-tunneled.
The architectural fork (the one decision everything hangs on)
Injection requires the payload’s traffic to be plaintext at the proxy. Two ways to get that:
Fork A — cooperative plaintext. The payload speaks plain HTTP to the loopback proxy, which applies policy, injects credentials host-side, and upgrades to TLS upstream. Payloads opt in via the mechanisms they already have: ANTHROPIC_BASE_URL, OPENAI_BASE_URL, git insteadOf rewrite, pip/npm registry URL config. The proxy validates the target host against policy before injecting — the injection is bound to the policy-checked host, so a payload cannot redirect the credential elsewhere.
Fork B — MITM. A cell-generated CA is injected into the jail trust store; the proxy terminates TLS, injects, re-encrypts. Transparent to unmodified payloads. Heavy: certificate pinning breaks (and much modern tooling pins), the crypto surface grows by an order of magnitude, and “cell now MITMs your traffic” is a sentence that costs trust no matter how carefully implemented.
Scoping recommendation: Fork A. The cooperative mechanism exists in every tool that matters (verified for the major LLM SDKs and git), the crypto story stays out of the jail, and the honest limitation — “payloads that can’t override their endpoint can’t receive injected credentials” — is the kind of sentence cell already knows how to say. Fork B is documented as considered and rejected unless the design round finds a fork-A-breaking requirement.
The design space around the fork
Complementary, not alternatives:
- Scoped short-lived tokens (zero cell changes). For GitHub specifically, App installation tokens are repo-scoped and expire in an hour — a leaked token is nearly worthless. This is correct operational practice regardless of what cell does, and the design doc should say so honestly: for some adopters it is the whole answer. It fails for LLM keys (not meaningfully scopable) and for operators who can’t run a minting service.
- SSH agent forwarding (verified mechanically feasible). The ssh-through- CONNECT path works (nest/git spikes); forwarding
SSH_AUTH_SOCKinto the jail keeps keys host-side entirely — the proven pattern, no new design. Solves git-over-ssh only, nothing HTTP. Candidate for the same version or a fast-follow; the design round decides whether it rides along. - Generic header injection (the core). The operator declares, per host:
cell run --credential api.github.com:Authorization=env:GH_TOKEN ...The value never appears in argv, audit, or the jail environment — the parent resolvesenv:references at spawn. Evidence records host, header name, and env key name; redaction is a harness-pinned property, not a promise.
Hard requirements the design must satisfy
- the secret never exists inside the jail — including to a payload that sniffs its own loopback: injection happens host-side after traffic leaves the netns, so in-jail plaintext carries no credential. Harness test: a payload running a loopback capture must recover nothing.
- injection is bound to policy: the host the operator declared is the host that was policy-checked and dialed; a rewritten Host header cannot steer the credential. Harness: hostile Host-header rewrite attempts.
- evidence redaction: injected values never appear in audit records, error messages, or egress logs — pinned by harness tests modeled on the existing
audit-secret-hygienecheck. - fail-closed: if the credential env var is absent, the run fails at setup with a typed error — never silently runs credential-less and lets the payload improvise.
- response-path honesty: upstream responses may carry credential- equivalents (session cookies, refresh tokens). v0.6 documents this as a known residual channel with per-service notes; stripping is out of scope unless the design round finds it cheap.
Sized work breakdown (if the design round confirms fork A)
| piece | size | notes |
|---|---|---|
--credential grammar + config plumbing | small | repeatable flag, env-ref resolution at spawn, validation |
| forward-mode HTTP upgrade in proxy.src | medium — the core | parse absolute-URI/Host, policy-check, inject, originate TLS upstream (platform capability confirmed: machin links OpenSSL, https_get verifies), stream response |
| injection evidence + redaction | small | new audit event type, redaction harness checks |
| threat-harness attack checks | small-medium | loopback-sniff, Host-rewrite, absent-credential fail-closed, downgrade-to-CONNECT behavior |
| git insteadOf / base-url recipes in docs | small | the adoption surface — copy-pasteable per tool |
| SSH agent forwarding (if it rides along) | small | socket bind + env, mostly validation |
Not in scope: MITM CA, per-service semantic logic beyond generic headers, response-header scrubbing, a token-minting service (documented as the operator’s job, with the GitHub App recipe as the example).
What the design round itself must produce
- fork confirmation or reversal, with the requirement that forces it
- the exact flag grammar (naming is user-facing forever)
- the request lifecycle in enough detail to implement without further design: parse, policy order-of-operations, injection point, TLS origination, streaming semantics (the proxy relay’s half-close lessons apply)
- the redaction enumeration: every place a credential value could leak
- explicit residual-risk section: response-path credential-equivalents, plaintext-in-jail request bodies (acceptable — payload’s own content), operator-misconfiguration shapes
Honest effort estimate
Design round: one focused session producing the design doc, no code. Implementation: two to three focused sessions, dominated by the proxy upgrade — the relay machinery exists, TLS origination exists in the platform, but they have never been composed, and the streaming semantics are where the bugs will live. SSH forwarding adds a session if it rides along. This is large enough to schedule deliberately and small enough to finish — it does not need to be a season.