Repository navigation
feat: let confidential requests require attested inference - #26
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
fallback_provider_model_idare database rows. Repointingprivate/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_FILTER_ENABLEDis 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.TINFOIL_CONFIG_REPO, also operator configuration. A repository Nexus controls, plusTINFOIL_ENCLAVE_HOSTpointing 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 owntinfoilsh/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": truein its encrypted envelope. The enclave then lets only attested code read the prompt: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.tinfoilsh/confidential-model-router. AnotherTINFOIL_CONFIG_REPOrefuses attested requests before any credit is held, and the client must have verified against the pinned repository before anything is sent.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_URLis 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 ./...🤖 Generated with Claude Code