fix(inworld): reject malformed base64 TTS audio#111197
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 19, 2026, 12:19 AM ET / 04:19 UTC. Summary PR surface: Source +4, Tests +9. Total +13 across 2 files. Reproducibility: yes. in source, with medium confidence: the supplied production-entry transport harness demonstrates that Node’s permissive base64 decoder accepts an invalid character, and the added focused test exercises the same Inworld response path. A fresh current-main rerun was not established in the supplied evidence. Review metrics: none identified. Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Keep the provider-owned strict validation through the shared base64 contract, retain coverage for malformed and supported valid payload forms, and merge once the normal exact-head checks and merge refresh permit it. Do we have a high-confidence way to reproduce the issue? Yes in source, with medium confidence: the supplied production-entry transport harness demonstrates that Node’s permissive base64 decoder accepts an invalid character, and the added focused test exercises the same Inworld response path. A fresh current-main rerun was not established in the supplied evidence. Is this the best way to solve the issue? Yes. Validating at the Inworld provider boundary with the existing shared media-runtime canonicalizer is narrower and more maintainable than adding a local parser or allowing malformed provider bytes to reach concatenation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 16e967eb7f53. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +4, Tests +9. Total +13 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Merge-ready with one PR-body correction to remove claim that URL-safe Base64 is preserved. The shared |
What Problem This Solves
Fixes an issue where users generating speech with Inworld TTS could receive silently corrupted audio when the provider returned malformed base64 in an otherwise successful response.
Why This Change Was Made
The Inworld response path now validates and canonicalizes each audio chunk with the shared media-runtime base64 contract before concatenation, while preserving valid padded, unpadded, URL-safe, and whitespace-bearing base64. Risk note: rejecting a valid provider payload would break TTS, so the existing success cases and a real production-entry transport harness cover both valid decoding and malformed rejection.
User Impact
Malformed Inworld audio now fails with a clear provider error instead of being decoded into plausible but corrupted bytes.
Evidence
Node
v24.18.0on Linuxx64demonstrates the underlying runtime behavior:Buffer.from("aGVs!bG8=", "base64")silently returnshelloeven though the payload contains an invalid character. Inworld's voice preview contract exposesaudioContentas base64: https://dev.docs.inworld.ai/api-reference/voiceAPI/voiceservice/get-voice-previewBefore, the real
inworldTTSproduction entry atupstream/main@c684b132133accepted that malformed provider value through a transport-only fetch stub:After this change, the same production entry and transport-only harness rejects it:
Focused repository test:
Touched-file
oxfmt,oxlint, andgit diff --checkpassed. The final autoreview completed cleanly with 0.95 confidence.AI-assisted: Codex helped implement and review the change; production-entry proof and focused validation were run manually.