Repository navigation
fix(google): reject malformed provider media base64 - #106969
sunlit-deng wants to merge 4 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 10:32 PM ET / July 28, 2026, 02:32 UTC. ClawSweeper reviewWhat this changesThis PR adds a Google-plugin-local strict base64 decoder for music, TTS, generated video, and Live voice media, accepting valid base64url while rejecting malformed payloads before media is materialized. Merge readinessKeep this PR open for normal maintainer merge review: current Priority: P2 Review scores
Verification
How this fits togetherThe bundled Google plugin receives inline media from Google generation and realtime APIs, converts it into buffers, and returns audio/video to OpenClaw’s media and voice-call flows. This change validates provider-returned encoded bytes at that plugin boundary before downstream playback, transcoding, or file output. flowchart LR
A[Google provider response] --> B[Google plugin media paths]
B --> C[Strict base64 validation]
C --> D{Valid encoded media?}
D -->|Yes| E[Decode audio or video buffer]
E --> F[Playback, transcoding, or generated media output]
D -->|No| G[Provider error without corrupt media]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +26, Tests +207. Total +233 across 9 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Merge the focused Google-plugin decoder after ordinary maintainer review, retaining the provider-local helper and the malformed/base64url regression coverage across all four affected media paths. Do we have a high-confidence way to reproduce the issue? Yes, source inspection gives a high-confidence reproduction path: send malformed Is this the best way to solve the issue? Yes. A Google-plugin-local decoder is the narrowest maintainable solution because it reuses the shared canonical base64 contract while preserving Google ProtoJSON-compatible base64url input and the existing generated-video size limit. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9bcc44301bcb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (35 earlier review cycles; latest 8 shown)
|
c9043ac to
f36b9f9
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
98c904d to
da4dc04
Compare
eaba38b to
e8d94a5
Compare
e8d94a5 to
a29361d
Compare
|
Closing as largely superseded — thanks @sunlit-deng, the bug you reported is real and it is fixed on Malformed base64 is now rejected with a named cause on every Google media path:
That came from a8e52b4 (#114041) for Gemini TTS and 91b1f96 (#114514) for provider binary payloads generally. Before those, a bad payload silently became corrupt audio or video — the outcome your PR was aimed at, and the reason it was worth filing. One piece of your PR is not on If you want that residual piece, a small PR against current Worth being straight about the process failure here: ClawSweeper's review on this PR still describes |
Thanks @obviyus — done in #116204. It is scoped to Google provider base64url normalization only. The PR includes comparable proof through |
What Problem This Solves
Fixes an issue where Google provider responses could include malformed inline audio or video base64 that Node would decode permissively instead of rejecting.
Why This Change Was Made
Google music, speech, video generation, and Realtime Live audio now share a strict base64 decoder before materializing provider-returned media. The Google-specific decoder accepts both standard base64 and Google ProtoJSON-valid base64url payloads before canonical validation, while inline video bytes reuse the existing generated-video byte cap before decode so oversized payloads fail before allocating the full buffer.
User Impact
Users get a clear provider error for malformed Google media responses without rejecting valid base64url media that Google may return. Realtime Live malformed inline audio is routed through
onErrorwithout emitting corrupt audio, and operators keep the existing video media cap behavior without permissive base64 decoding.Evidence
Live Google TTS run through the production
buildGoogleSpeechProvider().synthesize()entrypoint; this was captured on the earlier PR headf36b9f96544a6416e51712ee3881e682409df825before the base64url compatibility follow-up, and the same entrypoint remains covered by focused regression tests on current head4f77e023235:The focused tests drive the real exported provider entrypoints —
buildGoogleSpeechProvider().synthesize(),buildGoogleMusicGenerationProvider().generateMusic(),buildGoogleVideoGenerationProvider().generateVideo(), andbuildGoogleRealtimeVoiceProvider().createBridge()— with crafted valid, malformed, and oversized provider responses; thedecodeGoogleProviderBase64guard runs as real production code on those response paths:onAudio.Real-trigger-chain run of the production
buildGoogleSpeechProvider().synthesize()entrypoint with a crafted TTS response:CI notes:
origin/main. The earliercheck-dependenciesfailure flagged an unused export (CurrentUserTimestampOverride) insrc/agents/embedded-agent-runner/run/attempt-session-boundary.ts, a file this PR never touches; it was a stale-base artifact and clears after the rebase.check-lintoxlint(curly)error by adding braces to the guard inextensions/google/speech-provider.ts.Focused reproduction commands
AI-assisted: built with Codex