Skip to content

feat(confidential): declare where each confidential request went - #34

Merged
Marketen merged 2 commits into
mainfrom
feat/confidential-route-declaration
Dec 2, 2026
Merged

Marketen merged 2 commits into
mainfrom
feat/confidential-route-declaration

Conversation

@Marketen

@Marketen Marketen commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

The enclave's attestation proves which code handles a confidential request, but not where that code sends it. Which provider and upstream model serve a public model is catalog data from Metering, outside the enclave's measurements. The response also renames the upstream model to the public one. So a client can't tell where its encrypted request went.

Every successful response from /v1/confidential/chat/completions now declares its route in a top-level nexus_route object:

"nexus_route": {
  "version": 1,
  "request_id": "<the envelope's request_id>",
  "requested_model": "nexus/auto",
  "model": "minimax/minimax-m2.7",
  "router": "nexus/auto",
  "provider": "novita",
  "upstream_host": "api.novita.ai",
  "upstream_model": "minimax/minimax-m2.7",
  "fallback": false
}
  • Where it goes: in the JSON body, or in the first event a stream sends to the client.
  • Why it can be trusted: it is inside the EHBP-encrypted response, whose keys only the client and the enclave hold. Only the attested code can write it, and nothing in between can change it.
  • upstream_host: the catalog base URL's host. For Tinfoil, it is the enclave host the Gateway verified, from its transport proof.
  • No spoofing: a provider's own nexus_route field is replaced, however the key is escaped.
  • Fails closed: a request whose route can't be declared fails rather than answering without it. A bad catalog URL is caught before the provider runs.
  • Limit: it says where the request went, not what the provider ran; that still needs the provider's own attestation.

Compatibility

  • Plain /v1/chat/completions responses are unchanged.
  • No attestation, manifest or envelope change, so today's SDK keeps working; it passes the response body through unchanged.
  • OpenAI-compatible clients ignore the extra field. A client that rejects unknown response fields would need updating; I haven't found one in our stack.
  • Recording and showing the declaration in the SDK's verification ledger is a follow-up.

Tests

  • Service tests: provider and host, fallback, router choice, Tinfoil enclave host, both failure paths, one declaration per stream on the first event sent, and spoofed or invalid objects.
  • An end-to-end handler test encrypts an envelope and runs the confidential handler, the chat handler, the service and the real OpenAI adapter against a local upstream. It then decrypts the response and checks the declaration, streaming and not. It fails without the handler change.
  • go test ./... and go vet ./... pass on macOS.
  • In a golang:1.26.11-trixie container: go test ./..., the Nitro tests, the nitro_enclave amd64 compile and govulncheck (with and without the tag) pass. The arm64 Nitro build and gitleaks also pass.

🤖 Generated with Claude Code

Which provider and upstream model serve a public model is catalog data from
Metering, outside the enclave's measurements, and the response renames the
upstream model to the public one. So a client could not tell where an
encrypted request was sent.

Every successful confidential response now carries a top-level
`nexus_route` object, in the JSON body or the first streamed event: the
client's request_id, the requested and answering public models, the router
that chose, the provider, the upstream host, the exact upstream model name
and whether the fallback provider served it. It is inside the EHBP-encrypted
response, so only the attested code can write it. A provider's own field of
that name is replaced, and a request whose route can't be declared fails
instead of answering without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…acity

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marketen
Marketen merged commit c9d6c60 into main Dec 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants