fix(msteams): bound attachment JSON response reads to prevent OOM#97709
fix(msteams): bound attachment JSON response reads to prevent OOM#97709cxbAsDev wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 30, 2026, 6:05 AM ET / 10:05 UTC. Summary PR surface: Source +11, Tests +158. Total +169 across 4 files. Reproducibility: yes. for the source-level bug class: current main and v2026.6.10 have raw response.json() reads in the affected MSTeams attachment paths, and the PR head routes those reads through the shared capped helper. I did not run local tests because this review was read-only. Review metrics: 2 noteworthy metrics.
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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the bounded-reader runtime changes, return a fresh streaming Response in the Bot Framework overflow test, refresh current-head proof for all three reads, then let maintainers accept the 16 MiB cap tradeoff before merge. Do we have a high-confidence way to reproduce the issue? Yes for the source-level bug class: current main and v2026.6.10 have raw response.json() reads in the affected MSTeams attachment paths, and the PR head routes those reads through the shared capped helper. I did not run local tests because this review was read-only. Is this the best way to solve the issue? No as-is. Reusing readProviderJsonResponse is the best runtime fix, but the submitted branch should fix the cloned-stream test and refresh proof for the added Graph main-message read before merge. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 738b2be4b49b. Label changesLabel justifications:
Evidence reviewedPR surface: Source +11, Tests +158. Total +169 across 4 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
|
1b47339 to
f017a92
Compare
…nse tests - Replace unbounded msgRes.json() in downloadMSTeamsGraphMedia with readProviderJsonResponse (16 MiB cap), matching the existing bounded reads in fetchGraphCollection and fetchBotFrameworkAttachmentInfo. - Add three oversized-response tests covering all bounded-read paths: Graph main message, hostedContents collection, and Bot Framework attachmentInfo. Each test verifies the stream is cancelled on overflow and the caller handles the error gracefully. Co-Authored-By: Claude <[email protected]>
f017a92 to
6c8f0e4
Compare
Summary
Replace unbounded
response.json()withreadProviderJsonResponse(16 MiB cap) in MSTeams Bot Framework attachment info fetch and Graph collection fetch. Both already have try-catch error handling — this adds size bounding to the JSON parse path.Real behavior proof (required for external PRs)
Behavior addressed: Unbounded
response.json()replaced withreadProviderJsonResponse(16 MiB cap) in two MSTeams attachment paths.Real environment tested: Linux, Node 22, OpenClaw main @ 87db23e
Exact steps or command run after fix:
Evidence after fix:
All existing tests pass: 31/31 tests (bot-framework + graph).
What was not tested: Live Bot Framework v3 attachments API or Microsoft Graph API calls.
Risk
Low. Both functions already have try-catch that returns
undefinedor{ status, items: [] }on errors. The overflow error fromreadProviderJsonResponseis caught by the existing catch blocks, preserving the same graceful degradation.