media: the Gateway trusts an inbound attachment's declared type at the one seam every channel crosses #1111

Closed
opened 2026-10-27 13:39:03 +00:00 by sam · 0 comments
Owner

ValidateInbound runs only in the two current producers (channels/telegram/telegram.go:691, webui/api_chat.go:267). Every remote channel reaches the Gateway over gatewayrpc instead, which copies Type, MIMEType and Data unchecked (internal/infrastructure/gatewayrpc/values.go:76-84,232-236), and channelext serves that whole ChatService to a plugin (internal/infrastructure/channelext/channelext.go:83-86). The gateway then classifies on Type alone for transcription (internal/gateway/turn.go:488) and on MIMEType for image parts (internal/app/archiegateway/chat_turn_model.go:154-186), and its listener is sized to accept exactly this payload (internal/app/archiegateway/gateway.go:96-101).

Done when the check sits where the Gateway accepts a turn, so a channel extension or any other mTLS client cannot deliver a self-contradicting attachment, and the refusal is a codes.InvalidArgument rather than a silent success. A URL-only inbound attachment (no Data) is in the same class: it is fetched by the provider on the strength of the declared type.

Close reason

Route/Stream now validate inbound media (InvalidArgument); ValidateInbound sniffs image bytes. URL-only attachments not addressed.


Imported from beads archie-core-6xe3l · GitHub #1904 · type bug · priority P2 · created 2026-10-25 · closed 2026-10-27

ValidateInbound runs only in the two current producers (channels/telegram/telegram.go:691, webui/api_chat.go:267). Every remote channel reaches the Gateway over gatewayrpc instead, which copies Type, MIMEType and Data unchecked (internal/infrastructure/gatewayrpc/values.go:76-84,232-236), and channelext serves that whole ChatService to a plugin (internal/infrastructure/channelext/channelext.go:83-86). The gateway then classifies on Type alone for transcription (internal/gateway/turn.go:488) and on MIMEType for image parts (internal/app/archiegateway/chat_turn_model.go:154-186), and its listener is sized to accept exactly this payload (internal/app/archiegateway/gateway.go:96-101). Done when the check sits where the Gateway accepts a turn, so a channel extension or any other mTLS client cannot deliver a self-contradicting attachment, and the refusal is a codes.InvalidArgument rather than a silent success. A URL-only inbound attachment (no Data) is in the same class: it is fetched by the provider on the strength of the declared type. ### Close reason Route/Stream now validate inbound media (InvalidArgument); ValidateInbound sniffs image bytes. URL-only attachments not addressed. --- _Imported from beads `archie-core-6xe3l` · GitHub #1904 · type bug · priority P2 · created 2026-10-25 · closed 2026-10-27_
sam added the mediumbug labels 2026-10-27 13:39:03 +00:00
sam self-assigned this 2026-10-27 13:39:03 +00:00
sam closed this issue 2026-10-27 13:39:04 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1111