fix(googlechat): replace unbounded response.json() with readProviderJsonResponse#96772
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 26, 2026, 8:05 PM ET / 00:05 UTC. Summary PR surface: Source 0, Tests +133. Total +133 across 3 files. Reproducibility: Do we have a high-confidence way to reproduce the issue? Yes from source inspection and the supplied proof: current main uses native response.json()/text on the targeted paths, and the PR proof exercises oversized streamed bodies against the bounded helper path. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this focused helper-based fix once maintainers accept the shared response-size caps as the Google Chat compatibility policy and the latest head checks finish green. Do we have a high-confidence way to reproduce the issue? Do we have a high-confidence way to reproduce the issue? Yes from source inspection and the supplied proof: current main uses native response.json()/text on the targeted paths, and the PR proof exercises oversized streamed bodies against the bounded helper path. Is this the best way to solve the issue? Is this the best way to solve the issue? Yes; reusing readProviderJsonResponse and readResponseTextLimited keeps the byte-limit policy in the existing provider SDK helper layer instead of adding Google Chat-specific stream code or landing the broader overlapping batch. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ff35f3bb2cd6. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +133. Total +133 across 3 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
|
|
Upgraded proof: 9 assertions with quantified bytes-sent metrics (hostile body capped at ~16.0 MiB of 32 MiB payload, server stopped before full body). Added AI disclosure. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Added inline bounded-read regression tests (2 tests: oversized cert JSON + oversized sendMessage JSON, both verify stream cancelled early with bytes-pulled < cap). Removed unused var. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Follow openclaw#96772 pattern: export readJsonResponseForTest and add 5 inline tests (overflow + error prefix + negative control + happy path + HTTP error) that exercise readProviderJsonResponse through the production wrapper with a real oversized Response+ReadableStream. Upgrades from 🐚 to 🦞 per bounded-read-inline-test-requirement. Test results: 5/5 new tests pass, 26/26 total comfy tests pass.
|
Maintainer proof for
No blocking findings. Proceeding to merge if the wrapper's final drift check stays clean. |
debeff0 to
deaae33
Compare
deaae33 to
389c462
Compare
|
Maintainer proof refresh for the latest synced head
I’m merging this now unless the merge guard catches fresh main drift. |
…sonResponse Replace the local readGoogleChatJsonResponse and readGoogleChatCertsResponse wrappers with the existing SDK helper readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the Google Chat API JSON responses are bounded at 16 MiB, matching the non-streaming cap already used by 15+ other extensions. What changed: - extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now delegates to readProviderJsonResponse. Removed the local try/catch wrapper. - extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now delegates to readProviderJsonResponse. Error message preserved. Removed the local try/catch wrapper. This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio, provider JSON reads). No SDK promotion needed — readProviderJsonResponse is already available in openclaw/plugin-sdk/provider-http.
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
389c462 to
b353dc0
Compare
|
Maintainer proof refresh after latest main sync:
Proceeding with the repo merge wrapper now. |
|
Maintainer proof after refresh to current main:
Best-fix verdict: good to land. This keeps response-size policy in the shared provider HTTP contract and removes the remaining unbounded Google Chat response-body read on the same hot I/O boundary. |
|
Merged via squash.
|
|
Thanks @vincentkoc for merging! 🎉 This brings the googlechat success-body read in line with the rest of the bounded-read campaign. The #96989 SSE buffer-cap fix for OpenAI providers is the next piece landing shortly. |
…sonResponse (openclaw#96772) * fix(googlechat): replace unbounded response.json() with readProviderJsonResponse Replace the local readGoogleChatJsonResponse and readGoogleChatCertsResponse wrappers with the existing SDK helper readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the Google Chat API JSON responses are bounded at 16 MiB, matching the non-streaming cap already used by 15+ other extensions. What changed: - extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now delegates to readProviderJsonResponse. Removed the local try/catch wrapper. - extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now delegates to readProviderJsonResponse. Error message preserved. Removed the local try/catch wrapper. This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio, provider JSON reads). No SDK promotion needed — readProviderJsonResponse is already available in openclaw/plugin-sdk/provider-http. * fix(googlechat): add inline bounded-read regression tests Co-Authored-By: Claude <[email protected]> * fix(googlechat): remove unused variable flagged by oxlint Co-Authored-By: Claude <[email protected]> * fix(googlechat): bound api error body reads --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…sonResponse (openclaw#96772) * fix(googlechat): replace unbounded response.json() with readProviderJsonResponse Replace the local readGoogleChatJsonResponse and readGoogleChatCertsResponse wrappers with the existing SDK helper readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the Google Chat API JSON responses are bounded at 16 MiB, matching the non-streaming cap already used by 15+ other extensions. What changed: - extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now delegates to readProviderJsonResponse. Removed the local try/catch wrapper. - extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now delegates to readProviderJsonResponse. Error message preserved. Removed the local try/catch wrapper. This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio, provider JSON reads). No SDK promotion needed — readProviderJsonResponse is already available in openclaw/plugin-sdk/provider-http. * fix(googlechat): add inline bounded-read regression tests Co-Authored-By: Claude <[email protected]> * fix(googlechat): remove unused variable flagged by oxlint Co-Authored-By: Claude <[email protected]> * fix(googlechat): bound api error body reads --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…sonResponse (openclaw#96772) * fix(googlechat): replace unbounded response.json() with readProviderJsonResponse Replace the local readGoogleChatJsonResponse and readGoogleChatCertsResponse wrappers with the existing SDK helper readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the Google Chat API JSON responses are bounded at 16 MiB, matching the non-streaming cap already used by 15+ other extensions. What changed: - extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now delegates to readProviderJsonResponse. Removed the local try/catch wrapper. - extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now delegates to readProviderJsonResponse. Error message preserved. Removed the local try/catch wrapper. This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio, provider JSON reads). No SDK promotion needed — readProviderJsonResponse is already available in openclaw/plugin-sdk/provider-http. * fix(googlechat): add inline bounded-read regression tests Co-Authored-By: Claude <[email protected]> * fix(googlechat): remove unused variable flagged by oxlint Co-Authored-By: Claude <[email protected]> * fix(googlechat): bound api error body reads --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…sonResponse (openclaw#96772) * fix(googlechat): replace unbounded response.json() with readProviderJsonResponse Replace the local readGoogleChatJsonResponse and readGoogleChatCertsResponse wrappers with the existing SDK helper readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the Google Chat API JSON responses are bounded at 16 MiB, matching the non-streaming cap already used by 15+ other extensions. What changed: - extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now delegates to readProviderJsonResponse. Removed the local try/catch wrapper. - extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now delegates to readProviderJsonResponse. Error message preserved. Removed the local try/catch wrapper. This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio, provider JSON reads). No SDK promotion needed — readProviderJsonResponse is already available in openclaw/plugin-sdk/provider-http. * fix(googlechat): add inline bounded-read regression tests Co-Authored-By: Claude <[email protected]> * fix(googlechat): remove unused variable flagged by oxlint Co-Authored-By: Claude <[email protected]> * fix(googlechat): bound api error body reads --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…sonResponse (openclaw#96772) * fix(googlechat): replace unbounded response.json() with readProviderJsonResponse Replace the local readGoogleChatJsonResponse and readGoogleChatCertsResponse wrappers with the existing SDK helper readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the Google Chat API JSON responses are bounded at 16 MiB, matching the non-streaming cap already used by 15+ other extensions. What changed: - extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now delegates to readProviderJsonResponse. Removed the local try/catch wrapper. - extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now delegates to readProviderJsonResponse. Error message preserved. Removed the local try/catch wrapper. This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio, provider JSON reads). No SDK promotion needed — readProviderJsonResponse is already available in openclaw/plugin-sdk/provider-http. * fix(googlechat): add inline bounded-read regression tests Co-Authored-By: Claude <[email protected]> * fix(googlechat): remove unused variable flagged by oxlint Co-Authored-By: Claude <[email protected]> * fix(googlechat): bound api error body reads --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…sonResponse (openclaw#96772) * fix(googlechat): replace unbounded response.json() with readProviderJsonResponse Replace the local readGoogleChatJsonResponse and readGoogleChatCertsResponse wrappers with the existing SDK helper readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the Google Chat API JSON responses are bounded at 16 MiB, matching the non-streaming cap already used by 15+ other extensions. What changed: - extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now delegates to readProviderJsonResponse. Removed the local try/catch wrapper. - extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now delegates to readProviderJsonResponse. Error message preserved. Removed the local try/catch wrapper. This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio, provider JSON reads). No SDK promotion needed — readProviderJsonResponse is already available in openclaw/plugin-sdk/provider-http. * fix(googlechat): add inline bounded-read regression tests Co-Authored-By: Claude <[email protected]> * fix(googlechat): remove unused variable flagged by oxlint Co-Authored-By: Claude <[email protected]> * fix(googlechat): bound api error body reads --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
…sonResponse (openclaw#96772) * fix(googlechat): replace unbounded response.json() with readProviderJsonResponse Replace the local readGoogleChatJsonResponse and readGoogleChatCertsResponse wrappers with the existing SDK helper readProviderJsonResponse (from openclaw/plugin-sdk/provider-http) so the Google Chat API JSON responses are bounded at 16 MiB, matching the non-streaming cap already used by 15+ other extensions. What changed: - extensions/googlechat/src/api.ts: readGoogleChatJsonResponse now delegates to readProviderJsonResponse. Removed the local try/catch wrapper. - extensions/googlechat/src/auth.ts: readGoogleChatCertsResponse now delegates to readProviderJsonResponse. Error message preserved. Removed the local try/catch wrapper. This PR applies the same pattern as Alix-007's openclaw#96042, openclaw#96038 (lmstudio, provider JSON reads). No SDK promotion needed — readProviderJsonResponse is already available in openclaw/plugin-sdk/provider-http. * fix(googlechat): add inline bounded-read regression tests Co-Authored-By: Claude <[email protected]> * fix(googlechat): remove unused variable flagged by oxlint Co-Authored-By: Claude <[email protected]> * fix(googlechat): bound api error body reads --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Vincent Koc <[email protected]> (cherry picked from commit 4f3d81b)
What Problem This Solves
extensions/googlechat/src/api.ts(readGoogleChatJsonResponse) andextensions/googlechat/src/auth.ts(readGoogleChatCertsResponse) both callawait response.json()with no byte-level cap. A hostile or malfunctioning Google Chat API endpoint (or an intermediary) can return an oversized JSON body that exhausts process memory during JSON parsing.This is the same bounded-read pattern Alix-007 applied to 15+ other extensions (
readProviderJsonResponse, 16 MiB cap). Google Chat was one of the remaining unbounded.json()call sites.Changes
extensions/googlechat/src/api.ts:15-19—readGoogleChatJsonResponsenow delegates toreadProviderJsonResponse<T>(response, label). The localtry { return await response.json() } catch (cause) { throw new Error(..., { cause }) }wrapper is replaced by the SDK helper which provides the same error shape (${label}: malformed JSON response) plus a 16 MiB byte cap.extensions/googlechat/src/auth.ts:19-25—readGoogleChatCertsResponsenow delegates toreadProviderJsonResponse<Record<string, string>>(response, "Google Chat cert fetch failed"). Error message preserved identically.Real behavior proof
response.json()on Google Chat API and cert HTTP responses; after the fix reads are capped at 16 MiB.node:httpserver (127.0.0.1, chunked transfer, no Content-Length) driving productionreadProviderJsonResponse. Node v22.22.0, Linux x86_64.readProviderJsonResponsethrew canonical overflow at 16 MiB (JSON response exceeds 16777216 bytes). Server sent ~16.0 MiB of a 32 MiB hostile payload — capped before full body. Negative control (small JSON, status=ok) and happy path (valid JSON, text="hello") parsed correctly. Server-side bytes-sent confirmed cap activation at 16.0 MiB, not the full 32 MiB.Out of scope
extensions/googlechat/src/api.ts:117(fetchBuffer) already usesreadResponseWithLimitfor media downloads — not affected.Risk
(await response.json()) as TtoreadProviderJsonResponse<T>(response, label). Error messages are preserved (${label}: malformed JSON response). The helper is already used by 15+ extensions. The byte cap (16 MiB, default) is invisible to normal-sized responses.readProviderJsonResponsehas been inopenclaw/plugin-sdk/provider-httpsince the Alix-007 bounded-read sweep.AI-assisted; reviewed before submission.