fix(video-generation): bound DashScope JSON response reads#96248
fix(video-generation): bound DashScope JSON response reads#96248cxbAsDev wants to merge 2 commits into
Conversation
Replace raw response.json() with readResponseWithLimit to prevent unbounded buffering of DashScope video generation API responses (submit and poll paths), matching the existing provider response read pattern. A malicious or misconfigured DashScope-compatible endpoint could stream an unbounded JSON body, forcing the runtime to buffer it all before parsing. Co-Authored-By: Claude <[email protected]>
|
Codex review: needs changes before merge. Reviewed June 24, 2026, 1:57 AM ET / 05:57 UTC. Summary PR surface: Source +17. Total +17 across 1 file. Reproducibility: yes. source inspection shows current Review metrics: 1 noteworthy metric.
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:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the bounded-read implementation, but merge only after the DashScope test helpers and direct provider test mocks return real JSON Do we have a high-confidence way to reproduce the issue? Yes, source inspection shows current Is this the best way to solve the issue? Yes for the runtime layer: using the existing bounded response reader is the narrow maintainable fix. The PR is incomplete until adjacent DashScope provider mocks are updated to satisfy that response contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fd66b44f5e2c. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +17. Total +17 across 1 file. View PR surface stats
Acceptance criteria:
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
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Add arrayBuffer method to mock response objects in the DashScope video shared test helper and qwen extension test so readResponseWithLimit can fall back to arrayBuffer() when the mock Response has no body stream. Refs openclaw#96248 Co-Authored-By: Claude <[email protected]>
|
Closing this as superseded by #96782, which landed the same DashScope response-size cap through the shared provider JSON helper with green CI. |
Summary
Replace raw
response.json()withreadResponseWithLimitin DashScope video generation submit and poll paths to prevent unbounded buffering.Real behavior proof (required for external PRs)
Behavior addressed: Two unbounded
response.json()calls replaced withreadResponseWithLimit(16 MB cap).Real environment tested: Linux, Node 24, OpenClaw main @ 0671c08
Exact steps or command run after fix:
Evidence after fix:
The harness creates a streaming JSON body. The reader stops at 17 chunks (16 MB cap), cancels the stream, and throws. Before the fix, unbounded
response.json()would have buffered the entire body.Observed result after fix: Both submit and poll response reads bounded at 16 MB.
What was not tested: Live DashScope API endpoint was not tested.
Risk
Low.
readResponseWithLimitis already imported in the same file for video downloads.