media: the dashboard voice path validates two declarations, never the bytes, so a non-audio upload still reaches the transcriber #1628

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

api_chat.go:266 builds the attachment with Type fixed to voice and MIMEType taken from the request body, and internal/gateway/turn.go:488 transcribes on Type and Data alone -- MIMEType is never read. So ValidateInbound can only reject a request whose two self-declarations disagree, which no caller needs to do: any 10 MB blob with mime_type audio/ogg is transcribed by the operator's own provider key. The empty-mime_type case (media.go:90) skips the check outright.

Done when the dashboard's voice upload is checked against its bytes, not its claim -- container sniffing (OggS, matroska/WebM magic, ftyp for audio/mp4) rather than http.DetectContentType, which reports application/octet-stream for WebM -- and an undeclared mime_type is refused on that path while a platform adapter's genuinely unknown type stays acceptable.

Close reason

Bytes decide now: ValidateInbound sniffs the container when the bytes are present and refuses speech that is not in one of the containers a clip is recorded in (Ogg, WebM/Matroska, mp4/m4a, wav, flac, mp3). Proven red first: the two 'carrying html'/'carrying png' rows fail without the check. 6xe3l still covers the RPC seam, where attachments arrive with bytes the gateway never looks at.


Imported from beads archie-core-vf6e9 · GitHub #1903 · type bug · priority P2 · created 2026-10-25 · closed 2026-10-25

api_chat.go:266 builds the attachment with Type fixed to voice and MIMEType taken from the request body, and internal/gateway/turn.go:488 transcribes on Type and Data alone -- MIMEType is never read. So ValidateInbound can only reject a request whose two self-declarations disagree, which no caller needs to do: any 10 MB blob with mime_type audio/ogg is transcribed by the operator's own provider key. The empty-mime_type case (media.go:90) skips the check outright. Done when the dashboard's voice upload is checked against its bytes, not its claim -- container sniffing (OggS, matroska/WebM magic, ftyp for audio/mp4) rather than http.DetectContentType, which reports application/octet-stream for WebM -- and an undeclared mime_type is refused on that path while a platform adapter's genuinely unknown type stays acceptable. ### Close reason Bytes decide now: ValidateInbound sniffs the container when the bytes are present and refuses speech that is not in one of the containers a clip is recorded in (Ogg, WebM/Matroska, mp4/m4a, wav, flac, mp3). Proven red first: the two 'carrying html'/'carrying png' rows fail without the check. 6xe3l still covers the RPC seam, where attachments arrive with bytes the gateway never looks at. --- _Imported from beads `archie-core-vf6e9` · GitHub #1903 · type bug · priority P2 · created 2026-10-25 · closed 2026-10-25_
sam added the mediumbug labels 2026-10-27 13:41:09 +00:00
sam self-assigned this 2026-10-27 13:41:09 +00:00
sam closed this issue 2026-10-27 13:41:09 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1628