Skip to content

Secure attachments#95

Open
adambalogh wants to merge 6 commits into
mainfrom
claude/fervent-goodall-hrY9f
Open

Secure attachments#95
adambalogh wants to merge 6 commits into
mainfrom
claude/fervent-goodall-hrY9f

Conversation

@adambalogh
Copy link
Copy Markdown
Contributor

No description provided.

claude and others added 6 commits June 3, 2026 19:48
Stop flattening user content to text in the enclave. Convert OpenAI-format
content parts (text / image_url / file) into LangChain v1 standard content
blocks so images and PDFs reach the provider natively instead of being
dropped. Text-only content still collapses to a plain string.

No new dependencies: the pinned langchain-* versions already translate
standard image/file blocks to each provider's native API.
… attachments in request hash

- validate_attachments(): reject image/PDF parts when the target model's
  LangChain profile explicitly lacks support (fails open for unknown models),
  and enforce a 30 MB inline attachment cap. Wired into create_chat_completion
  so it covers both the direct and OHTTP-inner paths.
- Request hashing now canonicalizes multimodal user content, replacing inline
  base64 with a sha256 digest so the signed request commits to the exact
  attachment bytes without bloating the hashed payload.
…#94)

* image gen format fixes (#91)

* testing image format fix

* review fixes

* lint fix

* Minimize attachment handling: keep provider-native image pass-through

Revert the bespoke image-conversion path in convert_messages to main's raw
pass-through (text/image parts already convert correctly to every provider's
native API, so images keep working untouched). Only file/PDF parts are
rewritten to LangChain standard file blocks, since Anthropic needs a
'document' block and rejects OpenAI's raw file shape.

Capability gating, the per-request size cap, and request-hash canonicalization
are retained. Drop the design doc.

---------

Co-authored-by: Aniket Dixit <47004499+dixitaniket@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
…l-hrY9f

# Conflicts:
#	tee_gateway/controllers/chat_controller.py
#	tee_gateway/llm_backend.py
#	tee_gateway/test/test_tee_core.py
@adambalogh adambalogh marked this pull request as ready for review June 5, 2026 13:07
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