fix(extensions): bound JSON response reads to prevent OOM#97558
fix(extensions): bound JSON response reads to prevent OOM#97558NarahariRaghava wants to merge 1 commit into
Conversation
|
Thanks for the context here. I did a careful shell check against current Close: current main now has same-or-better bounded JSON response handling across the touched extension paths, and the proof commit is current-main-only rather than shipped in v2026.6.11. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep current main as the canonical implementation and use future narrow per-plugin PRs only if a new unbounded response path is found against current main. Do we have a high-confidence way to reproduce the issue? Yes. The PR diff shows the original source-level unbounded Is this the best way to solve the issue? No, this branch is no longer the best merge path. Current main has same-or-better bounded-reader coverage, stronger focused tests, and the branch is now conflicting with already-landed work. Security review: Security review cleared: The diff narrows external response-body handling and adds no new dependencies, downloaded code, secret handling, package-resolution, or workflow execution surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 4ae8d735bf54; fix evidence: commit 3dbe98a1f737, main fix timestamp 2026-07-07T23:13:55Z. |
d85e77d to
66e9df3
Compare
|
Current CI triage for this head (
Other relevant early checks I saw were green, including |
66e9df3 to
26788c8
Compare
98eb6ce to
8f29e22
Compare
|
Addressed both findings:
|
8f29e22 to
57d5968
Compare
|
Addressed all findings:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
57d5968 to
245504c
Compare
|
Addressed remaining findings:
Changed-path proof — Terminal output shows
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
245504c to
3f52a5a
Compare
3f52a5a to
bda6c3d
Compare
Replace unbounded response.json() calls with readProviderJsonResponse in Feishu, Discord, Google Meet, and Tlon.
bda6c3d to
366573a
Compare
|
Narrowed PR scope: removed MS Teams to keep the PR clean and focused. MS Teams has additional sibling paths (Bot Framework attachment reader, Graph error visibility) that deserve their own dedicated PR. This PR now covers: Feishu, Discord, Google Meet, and Tlon only. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
The focused Tlon scry slice has landed via #100376 after bounded loopback proof, sanitized AWS focused tests, exact-head CI, and fresh autoreview. Please remove these overlapping files from this broader PR before further review:
The Discord, Feishu, Google Meet, Tlon API, and SDK-surface work remains distinct and should stay independently reviewable. Thanks for the broader response-bounds work. |
|
ClawSweeper applied the proposed close for this PR.
|


What Problem This Solves
Fixes an issue where a malformed or unexpectedly large API response from external services (Feishu, Discord, Google Meet, Tlon) could cause the gateway process to buffer an arbitrarily large payload into memory, leading to an out-of-memory crash.
Why This Change Was Made
Recent work bounded response reads across most extensions to prevent OOM from oversized API responses. Several extensions still used raw
response.json()without size limits. This change replaces those calls with the sharedreadProviderJsonResponsehelper, which caps reads at a safe limit. Existing error handling patterns (try/catch, .catch() fallbacks) are preserved.User Impact
Gateway operators running Feishu, Discord, Google Meet, or Tlon channel plugins are protected from OOM crashes caused by unexpectedly large external API responses.
Evidence
All 1136 tests pass across 84 test files. Build succeeds. Terminal proof shows the bounded reader rejecting a 20MB response with "Discord PluralKit response: JSON response exceeds 16777216 bytes" while normal responses parse correctly.