Repository navigation
Conversation
A key's PII mode was silently ignored on the enclave gateway: the analyzer lived outside it, so masking was switched off there. Confidential requests to models whose provider can read the prompt went out unmasked. Run Presidio inside the enclave so masking works on confidential requests without prompt text leaving measured code: - nexus-enclave-init is the enclave entrypoint. It reads apps/gateway/enclave/services.yaml (Compose-like), brings up loopback, starts Presidio as uid 1001, starts the gateway once Presidio is healthy, restarts a service that exits (clearing its process group first), reaps orphans, and stops everything in reverse order. The gateway launches nothing itself. A service gets a minimal environment unless it opts in. - Dockerfile.enclave: the runtime image is presidio-analyzer 2.2.362 pinned by digest, with the gateway and the init added. - In Nitro builds the gateway refuses a PRESIDIO_ANALYZER_URL that is not http://127.0.0.1:<port> and reaches the analyzer through a loopback-only transport, so the provider-only egress allowlist is unchanged. Requests that require attested inference still skip masking: their provider cannot read the prompt. Ordinary (non-Nitro) builds are unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
working_dir and environment mean what they mean in Docker Compose, so the file reads like one. Co-Authored-By: Claude Fable 5.2 <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.
Why
A key's PII mode is silently ignored on the enclave gateway. The analyzer runs outside the enclave, so masking is switched off there (
PII_FILTER_ENABLED=false), and a confidential request to a model whose provider can read the prompt (DeepSeek, Novita) goes out unmasked with no error.That is the case where masking matters most. On a confidential request the provider sees the prompt but not who sent it, and Nexus knows who sent it but cannot read it. A name or an email inside the prompt breaks the first half of that.
What changes
Only what is needed to mask inside the enclave. Ordinary (non-Nitro) builds behave exactly as before.
nexus-enclave-init(apps/gateway/cmd/nexus-enclave-init) is the enclave entrypoint. It readsapps/gateway/enclave/services.yaml, which uses Docker Compose's key names (command,user,working_dir,environment,depends_on,restart), brings up loopback, starts Presidio as uid 1001, starts the gateway once Presidio is healthy, restarts a service that exits (clearing its process group first so a leftover worker cannot hold the port), reaps orphans, and stops everything in reverse order. The gateway launches nothing itself. A service gets a minimal environment unless it setsinherit_env.Dockerfile.enclave: the runtime image ispresidio-analyzer:2.2.362pinned by digest (the version the regular gateway runs), with the gateway and the init added. Same builder and reproducibility rules.PRESIDIO_ANALYZER_URLishttp://127.0.0.1:<port>, and reaches the analyzer through a transport that dials nothing but 127.0.0.0/8. The provider egress allowlist and the manifest are unchanged.Requests with
require_attested_inferencestill skip masking: their provider cannot read the prompt.Not in this PR
The analyzer result cache, enclave metrics, new provider routes and the FX fix from #27 are left out on purpose; they are independent and will come as separate small PRs.
Checked locally (2 CPUs and 4 GB, like the enclave)
PERSONandEMAIL_ADDRESSin a sample text on 127.0.0.1:3000go test ./...passes; Nitro build compiles and vets--no-cacheamd64 builds withrewrite-timestamp(at 173403f): identical image ID and identical PCR0, PCR1, PCR2. Image 582 MB, EIF 1.0 GB (was 40 MB)Deploying
Needs the companion infrastructure PR: the enclave image grows from 40 MB to about 1 GB, so the enclave needs 4096 MiB instead of 2048, and the bundle must turn
PII_FILTER_ENABLEDon. Without it the new image does not fit.Open
🤖 Generated with Claude Code