Skip to content

feat: let confidential requests require attested inference - #26

Merged
Marketen merged 4 commits into
mainfrom
feat/browser-verified-privacy
Nov 17, 2026
Merged

Marketen merged 4 commits into
mainfrom
feat/browser-verified-privacy

Conversation

@Marketen

@Marketen Marketen commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Web chat is going to claim, for private models only: "Nobody can read your prompt — not Nexus, not the model provider." The browser verifies, by attestation, that its prompt reaches this enclave's code encrypted. For the claim to hold, that code alone has to guarantee where the prompt goes next.

Today it doesn't. A request for a private model never touches the Router, and the enclave runs with PII masking off, but where the prompt goes is decided by things outside the attested code, which Nexus controls and the browser can't see:

  • Provider and fallback. The enclave reads the catalog from Metering, so the provider a model maps to and its fallback_provider_model_id are database rows. Repointing private/gemma4-31b, or its fallback, at DeepSeek or Novita (both have keys in the enclave) would send the prompt there, and the browser would still report a verified enclave.
  • PII masking. PII_FILTER_ENABLED is operator configuration in the enclave's secret envelope, not part of its measurements. Turning it on would send the text to the analyzer outside the enclave.
  • Which Tinfoil code is trusted. The Tinfoil SDK verifies the provider enclave against the repository in TINFOIL_CONFIG_REPO, also operator configuration. A repository Nexus controls, plus TINFOIL_ENCLAVE_HOST pointing at an enclave built from it, would pass verification while running code that could read the prompt. Production leaves it unset, so the SDK uses Tinfoil's own tinfoilsh/confidential-model-router.

This PR moves the guarantee into the attested code: a request that asks for attested inference goes only to an attested provider, whatever the catalog or the configuration says.

Behavior

A confidential request may set "require_attested_inference": true in its encrypted envelope. The enclave then lets only attested code read the prompt:

  • Chat completions only; any other endpoint is refused.
  • No Router: a router model ID is refused rather than resolved.
  • No PII masking, which would send the prompt to the analyzer.
  • Only providers whose adapter declares AttestedTransport() (today Tinfoil, which verifies the provider enclave's attestation and encrypts to it over EHBP). The primary model and the fallback are each checked, both before the credit hold and again at send time.
  • The Tinfoil code is pinned in this binary to tinfoilsh/confidential-model-router. Another TINFOIL_CONFIG_REPO refuses attested requests before any credit is held, and the client must have verified against the pinned repository before anything is sent.
  • An attested provider that returns no transport proof fails the request; the answer isn't delivered without evidence.
  • No server-side Tinfoil proof is stored for these requests. The client keeps its own, and a server copy would only be a permanent record of which account used a private model when.

Anything it can't serve that way gets 422 attested_inference_unavailable, and nothing is sent upstream.

The flag lives inside the encrypted body, so nothing between the client and the enclave can add or strip it. Every release with the confidential endpoint (v0.1.60–v0.1.72) decodes the envelope with DisallowUnknownFields, so an older enclave rejects the flag rather than ignoring it. Rolling the enclave back fails closed.

What leaves the enclave for these requests: Metering reservations and failures carry IDs, counts, error type and code, never message text.

Rollout

Nothing changes for requests without the flag. Web chat sends it only once PRIVATE_CHAT_GATEWAY_URL is set on the control plane (dappnode-nexus, off by default), and that must happen after the enclave runs a release containing this PR.

Validation

  • go test ./...
  • New tests cover each refusal, including an enclave verified against an unpinned repository: router, non-chat endpoint, non-attested primary, non-attested fallback, missing proof (stream and non-stream), PII skipped, no proof stored. Each check was removed in turn to confirm a test fails.
  • Envelope decoding: the flag is honoured only from the decrypted body, and unknown fields are still rejected.

🤖 Generated with Claude Code

Marketen and others added 4 commits November 16, 2026 16:09
A confidential request can now set "require_attested_inference": true
inside its encrypted envelope. The enclave then lets only attested code
read the prompt: itself and a provider whose attestation it verifies
before sending anything. It refuses routers, which send the prompt to the
Router outside the enclave; skips PII masking, which sends it to the
analyzer; checks every provider target, fallback included, for an
attested transport before holding credit or sending; and discards an
answer that arrives without a transport proof. A request it can't serve
that way returns 422 attested_inference_unavailable.

The field travels inside the EHBP-encrypted body, so nothing between the
client and the enclave can add or remove it. Gateways that predate it
reject the envelope as unknown, so asking for it fails closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The client of an attested-inference request verifies the enclave itself
and keeps its own proof, so a stored Tinfoil transport proof would only be
a lasting record of which account used a private model, and when.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Tinfoil SDK verifies the provider enclave against the repository in
TINFOIL_CONFIG_REPO, which is operator configuration outside this enclave's
measurements. Pointing it at another repository, and TINFOIL_ENCLAVE_HOST at
an enclave built from it, would pass verification while running code that
could read the prompt.

Attested inference now requires Tinfoil's own model router
(tinfoilsh/confidential-model-router), compiled in: AttestedTransport is
false for any other configured repository, and the client must have verified
against it before anything is sent. Production uses the SDK default, which
is that repository, so nothing changes there. Ordinary requests are
unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Compute the Tinfoil repo the way tinfoil-go does: it uses
  TINFOIL_CONFIG_REPO only with an enclave host or bundle URL, so the
  pre-check no longer refuses requests the SDK would verify correctly.
  One helper reads each variable for both the check and the client.
- A client verified against another repo after the pre-check passed is
  Nexus's misconfiguration: report it as provider unavailable, not as an
  invalid request.
- Tests no longer depend on TINFOIL_CONFIG_REPO in the environment.
- Say why no server proof is stored without overstating it (Metering
  still keeps billing usage), and that attested inference skips masking
  whatever the key's PII mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Marketen
Marketen merged commit ebbe928 into main Nov 17, 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.

1 participant