Skip to content

Refuse an endpoint outside the provider's E2EE coverage with 403 and say why - #230

Merged
13rac1 merged 2 commits into
13rac1:mainfrom
ai-13rac1:e2ee-uncovered-endpoints-2
Nov 14, 2026
Merged

13rac1 merged 2 commits into
13rac1:mainfrom
ai-13rac1:e2ee-uncovered-endpoints-2

Conversation

@ai-13rac1

Copy link
Copy Markdown
Contributor

Problem

Each provider's E2EE protocol supports some endpoints only.

  • With E2EE enabled, teep refused audio transcription with a message that gave no reason: "audio transcription requires TLS-level E2EE (pinned provider)".
  • Teep had no route for NEAR's /v1/images/edits, /v1/privacy/classify, /v1/privacy/redact and /v1/responses. NEAR's E2EE does not support these endpoints either. On 2026-11-14, /v1/privacy/classify did not decrypt an encrypted input: the model classified the ciphertext.
  • No code stated which endpoints each provider's E2EE supports, so the rule could not apply to every provider alike.

Change

  • RequestEncryptor declares the endpoints that it supports (CoversE2EE). The declarations state the existing behavior:
    • NEAR (direct and cloud): chat, completions (NearDirect only, which routes it), embeddings, image generation, rerank, score.
    • Tinfoil: chat, embeddings, responses, speech.
    • Chutes: chat, embeddings.
    • Venice and E2EE v2 (NanoGPT, Phala Cloud): chat.
  • With E2EE enabled, teep refuses a request to an endpoint that the provider's E2EE does not support, before it sends anything:
    • HTTP 403, error type e2ee_not_covered, with provider and endpoint fields.
    • The message says why. It also says what the user sets to send the request without E2EE: e2ee = false, plus e2ee_usable in allow_fail where the policy enforces that factor. It calls the TLS connection attested only for a provider that uses TLS binding.
    • One warning log line, with no request content.
    • With E2EE enabled, a provider without an encryptor supports no endpoint.
  • New routes: /v1/privacy/classify, /v1/privacy/redact, /v1/images/edits and /v1/responses for NearDirect and NearCloud, and audio transcription for NearCloud. With E2EE enabled, teep refuses them.
  • Each encryptor checks its own declaration first, and returns e2ee.ErrEndpointNotCovered for an endpoint outside it, before it reads the key or the body. Before this change, the Tinfoil and Chutes encryptors ignored the endpoint.
  • The dashboard counts the refusals for each provider and lists the endpoints that its E2EE supports and does not support.
  • docs/api_support.md states the rule and lists the new routes. A new section, "Why teep refused my request", explains the refusal.

Effect

The refused endpoints with E2EE enabled:

  • NearDirect and NearCloud: responses, image edits, audio transcription, privacy classify and redact.
  • Phala Cloud: embeddings.
  • Tinfoil: audio transcription.

The user gets one answer that names the provider, the endpoint and the setting. Previously, audio transcription was refused with an unclear message, and the NEAR endpoints had no route.

To verify

go test -race ./internal/proxy -run 'TestUncoveredEndpoint|TestNotCovered|TestE2EECoverage|TestEncryptorsRefuseUncoveredEndpoints'
make check

TestUncoveredEndpointRefused sends each refused endpoint through the HTTP handler and checks the 403 body and the counter. TestE2EECoverage checks the coverage of every provider and the dashboard lists. TestEncryptorsRefuseUncoveredEndpoints runs every endpoint type through each production encryptor and fails when the declaration and the encryption disagree.

This branch builds on the NEAR completions change and merges after it.

Checklist

  • I added unit tests for new code and regression tests for fixed bugs.
  • make check passes.
  • For a major feature: make integration and make reports pass.
  • I updated the documentation that this change affects.

ai-13rac1 and others added 2 commits November 14, 2026 04:36
…swer

Each provider's E2EE covers some endpoints only. Teep refused audio
transcription with E2EE enabled with a message that named no reason
("audio transcription requires TLS-level E2EE (pinned provider)"), and
had no route for NEAR's image edits, privacy and responses endpoints,
which NEAR's E2EE does not cover either.

With E2EE enabled, an endpoint outside the provider's E2EE coverage is
now refused, for every provider alike, and the user sees why.

Changes:

- RequestEncryptor declares its coverage (CoversE2EE). The declarations
  state the existing behavior: NEAR covers chat, completions (NEAR AI
  direct only), embeddings, image generation, rerank and score; Tinfoil
  EHBP covers chat, embeddings, responses and speech; Chutes covers chat
  and embeddings; Venice and E2EE v2 cover chat.
- With E2EE enabled, a request on an uncovered endpoint is refused with
  HTTP 403 before anything is sent. The error has type
  e2ee_not_covered, names the provider and the endpoint, and states
  what the user sets to send it without E2EE: e2ee = false, and
  e2ee_usable in allow_fail where the policy enforces it. It states
  attested TLS only for a provider that uses TLS binding. One warning
  is logged, with no request content. This replaces the audio refusal.
  With E2EE enabled, a provider without an encryptor covers no
  endpoint.
- New routes for /v1/privacy/classify, /v1/privacy/redact,
  /v1/images/edits and /v1/responses on neardirect and nearcloud, and
  audio on nearcloud. They are plain routes with e2ee = false, and
  refused with E2EE enabled.
- The dashboard counts the refusals for each provider and lists the
  endpoints that its E2EE covers and does not.
- The API support document states the rule, the new routes and a
  section on why teep refused a request.

To verify: go test ./internal/proxy -run
'TestUncoveredEndpoint|TestNotCovered|TestE2EECoverage'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Tinfoil and Chutes encryptors ignored their endpoint argument, so
their CoversE2EE declaration was the only check of which endpoints
they encrypt. A wrong entry there would send a body that the provider
cannot use through EHBP or Chutes E2EE with no other check to stop it.

Each encryptor now checks its own CoversE2EE first and returns
e2ee.ErrEndpointNotCovered before it reads the key or the body. A test
runs every endpoint type through each production encryptor and fails
when the declaration and the encryption disagree. The dashboard also
lists the endpoints that each provider's E2EE covers, next to those it
does not.

To verify: go test ./internal/proxy -run
TestEncryptorsRefuseUncoveredEndpoints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ai-13rac1
ai-13rac1 force-pushed the e2ee-uncovered-endpoints-2 branch from 6c03c92 to dd94aec Compare November 14, 2026 05:00
@13rac1
13rac1 merged commit 1bdd449 into 13rac1:main Nov 14, 2026
3 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