feat: complete E2EE support for chat/completions (ECDSA + Ed25519) with replay protection, attestation public key, and verification tooling#5
Open
mondaylord wants to merge 9 commits intomainfrom
Open
Conversation
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.
Summary
This PR adds full E2EE support for
/v1/chat/completionswith both ECDSA and Ed25519, including:vllm-proxycompatibilitynonce + timestamp, Redis-backed)signing_public_key)Motivation
We need practical, production-ready E2EE for chat completions in TEE deployments while keeping OpenAI-compatible API ergonomics and cross-instance replay safety.
What's included
1) E2EE core (
src/app/api/v1/e2ee.py)secp256k1ECDH + HKDF + AES-GCM)v2|req|...v2|resp|...content,reasoning_content)delta.content,delta.reasoning_content)X-E2EE-Version: 2ORnonce+timestamppresent2) OpenAI route integration (
src/app/api/v1/openai.py)/v1/chat/completionsX-E2EE-AppliedX-E2EE-VersionX-E2EE-Algo/v1/completionsrejecting E2EE usage3) Replay protection cache
src/app/cache/replay_cache.pyset_if_absent(SET NX EX) support insrc/app/cache/redis.py4) Attestation enhancement
/v1/attestation/reportnow includessigning_public_keyall_attestationsitem5) Docs + tests + verification tooling
docs/e2ee_protocol.mdtests/app/test_openai_e2ee.pytests/app/test_e2ee_cache.pytests/app/verify_nonstream_ecdsa_e2ee.pytests/app/verify_stream_ecdsa_e2ee.pytests/app/verify_nonstream_ed25519_e2ee.pytests/app/verify_stream_ed25519_e2ee.pyBackward compatibility
attestation/reportchange is additive (signing_public_key)Validation results (real deployment)
Validated on deployed proxy URL with model
Qwen/Qwen3.5-27B:Notes
e2ee_replay_detected)X-E2EE-Nonce+X-E2EE-Timestampsigning_public_keyis hex without0xprefix