safekeys/sidecar-resolution [built]
Token resolution is the act that turns a capability token into a plaintext value for exactly one non-LLM consumer. It happens only in the privileged sidecar: verify the token, unwrap the DEK, decrypt the object, inject into the consumer, zeroise. The sidecar is the only component allowed to perform it, and it denies by default.
Status: built
Why this exists
This is the enforcement point for the whole product. Every other component can be compromised or merely careless; as long as resolution only occurs inside a separated privileged process that checks a token first, the model never sees a secret. Concentrating the sensitive operation in one auditable place is what makes the security property architectural rather than aspirational.
Design decisions
sidecar-is-the-only-resolver [accepted]
Decision: Concentrate all token resolution and decryption in the privileged sidecar.
Rationale: A single auditable enforcement point is easier to isolate, review, and harden than resolution logic spread across SDKs and runtimes — and it is what lets the agent-facing API stay stable while the backend changes.
socket-request-response [accepted]
Decision: Expose resolution to local callers over a Unix domain socket.
Rationale: It provides a natural authenticated local channel, avoids exposing a network port, and lets the OS enforce filesystem permissions on who may even connect. Long-running local services also need the pipe/socket injection mode anyway.
no-shared-memory [accepted]
Decision: The sidecar shares no memory with agent processes.
Rationale: The architectural promise is that a compromised agent sandbox does not yield the key; shared memory would reintroduce exactly the surface being eliminated.
sidecar-holds-public-keys-only [accepted]
Decision: Split protocol.Signer (mint) from protocol.Verifier (public keys only). The sidecar and CLI hold a Verifier and never a Signer.
Rationale: The sidecar runs on the same host as the secrets, which makes it the component most likely to be attacked. If it held a signing key, compromising it would let an attacker mint tokens and defeat the whole model — the sidecar would become the weakest link in the chain it exists to protect. Splitting the interfaces makes that structurally impossible rather than a rule: a Verifier has no Sign method in scope, so the failure cannot be written by accident. The control plane publishes its public keys at /v1/keys and the sidecar fetches and caches them, refreshing on an unknown kid so a key rotation propagates without a restart.
Alternatives considered:
- Share one signing key between the control plane and the sidecar — rejected: This was the original arrangement — a SAFEKEYS_DEV_SIGNING_KEY read by both. It gave the sidecar minting authority, so a host compromise escalated from reading one secret to minting tokens for any object.
- Give the sidecar a separate signing key — rejected: Two authorities to revoke and two keys to rotate, for no benefit: the sidecar has no reason to mint anything.
Consequences: Verification keys must be distributable, so /v1/keys is now a real endpoint publishing PUBLIC keys only and unauthenticated by design — publishing a public key is not a disclosure, and requiring a credential to check a signature would reintroduce the problem. A test asserts keysource.Verifier does not satisfy protocol.Signer.
Date: 2026-09-26
verifier-fails-closed-cold [accepted]
Decision: A verifier with a cold key cache and an unreachable control plane denies every token; a warm cache serves last-known-good.
Rationale: A verifier that cannot check a signature must not accept one — that is the definition of failing open. But taking resolution dark on a brief control-plane blip would be its own outage. The distinction is between never having verified (cold: deny) and having verified recently (warm: serve, since key staleness is handled by revocation, not by refusing to work). The same shape applies to the policy cache.
Consequences: Startup fails if the control plane is unreachable and no static keys are configured, so a misconfiguration is obvious at boot rather than as a silent deny-everything.
Date: 2026-09-26
How it works
Resolve a token and inject the secret (resolve-and-inject)
The sidecar takes a token from a local caller and injects the secret into a non-LLM consumer.
- Receive — Receive a resolve request and capability token over the local Unix domain socket.
- Validate — Verify signature, expiry, audience, scope, and jti denylist. Deny on any failure.
- Validate — Evaluate local policy — may this process request this injection method for this object?
- Transmit — Request DEK unwrap from the key store.
- Decrypt — Decrypt the target object in sidecar memory.
- Send — Inject into the consumer (env var, temp file, socket/pipe, or exec).
- Delete — Zeroise the plaintext and DEK, then return only a success code.
- Observe — Append an audit record — who, what scope, which jti, which host — without plaintext.