fix(msteams): bound graph-upload JSON response reads to prevent OOM#97711
fix(msteams): bound graph-upload JSON response reads to prevent OOM#97711cxbAsDev wants to merge 2 commits into
Conversation
Replace 7 unbounded res.json() calls with readProviderJsonResponse (16 MiB cap) in OneDrive/SharePoint upload, sharing link, driveItem, chat listing, and chat member fetch paths.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: #97784 covers the same seven Microsoft Teams graph-upload JSON reads, adds stronger loopback proof, and is already marked proof-sufficient while this branch has no unique runtime fix left. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #97784 as the canonical graph-upload bounded-read path, then land or reject that PR after maintainer acceptance of the 16 MiB cap and exact-head validation. So I’m closing this here and keeping the remaining discussion on #97784. Review detailsBest possible solution: Use #97784 as the canonical graph-upload bounded-read path, then land or reject that PR after maintainer acceptance of the 16 MiB cap and exact-head validation. Do we have a high-confidence way to reproduce the issue? Yes, source-level: current main has seven raw Is this the best way to solve the issue? No for this branch as the landing vehicle: the implementation shape is right, but #97784 is the better solution because it covers the same code with stronger real HTTP loopback proof. A custom reader or broader multi-plugin sweep would be riskier for this narrow bug. Security review: Security review cleared: The diff reuses an existing bounded SDK HTTP helper and adds a test; it does not change dependencies, workflows, package metadata, permissions, endpoints, auth headers, or secret handling. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 72f837a4a478. |
What Problem This Solves
Replace 7 unbounded
res.json()calls withreadProviderJsonResponse(16 MiB cap) in MSTeams OneDrive/SharePoint upload, sharing link, driveItem properties, chat listing, and chat member fetch paths. Without a bound, an oversized or malicious JSON response can OOM the process.Why This Change Was Made
All JSON response reads from external HTTP endpoints should use
readProviderJsonResponseorreadResponseWithLimitto prevent unbounded memory consumption. This is the same pattern already used inbot-framework.tsandgraph.ts.User Impact
MS Teams file upload, SharePoint sharing, chat resolution, and member fetching are now protected against oversized JSON responses. No functional change for normal-sized responses.
Evidence
Environment: Linux, Node 22, OpenClaw main
All existing tests pass (12/12 in graph-upload.test.ts):
Oversized response test proves stream cancellation on 18 MiB payload:
Bundle lint: clean.
Risk
Low. Same
readProviderJsonResponsehelper already used inbot-framework.tsandgraph.ts. Pure replacement with 16 MiB cap matching codebase convention.🤖 Generated with Claude Code