Skip to content

fix(minimax): bound video control response reads#96889

Merged
sallyom merged 7 commits into
openclaw:mainfrom
Alix-007:fix/bound-minimax
Jun 28, 2026
Merged

fix(minimax): bound video control response reads#96889
sallyom merged 7 commits into
openclaw:mainfrom
Alix-007:fix/bound-minimax

Conversation

@Alix-007

@Alix-007 Alix-007 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The MiniMax video provider read several success/control-path JSON responses with unbounded await response.json(), so a misbehaving or hostile MiniMax endpoint could stream an arbitrarily large body into memory before parsing and exhaust the process (OOM / hang). The HTTP error path is already bounded by assertOkOrThrowHttpError; this closes the matching gap on the MiniMax video success/control side.

Three video JSON reads are affected:

  • extensions/minimax/video-generation-provider.ts — video generation task submit response
  • extensions/minimax/video-generation-provider.ts — video generation status poll response
  • extensions/minimax/video-generation-provider.ts — video generation file_id metadata response before the binary download

MiniMax TTS is already bounded and is left unchanged. MiniMax image response sizing is intentionally left out of this PR because image responses can carry large inline base64 payloads and should use an image-sized cap in the broader image-response hardening work.

Changes

  • Read all three MiniMax video success/control JSON bodies through the shared bounded reader readProviderJsonResponse (16 MiB cap), which cancels the underlying stream on overflow instead of buffering the whole payload.
  • No new abstraction added; this reuses the existing plugin-SDK helper already used by sibling provider paths.
  • Keep the MiniMax provider HTTP tests' readProviderJsonResponse implementation real via importActual, while continuing to mock transport/auth seams.
  • Update MiniMax video tests to use real Response JSON fixtures and add a focused file_id metadata overflow regression proving the metadata path fails before attempting the binary download.
  • Remove the MiniMax image-provider change from this branch so image-sized response caps can be handled by the broader image hardening PR without conflicting with this video-focused fix.

Real behavior proof

  • Behavior addressed: an untrusted MiniMax video success/control JSON response that streams more than 16 MiB must be rejected without buffering the full body; small/legitimate responses must still parse.
  • Real environment tested: a real node:http loopback server streaming a >16 MiB JSON body with no Content-Length (chunked), fetched over a real TCP socket, driving the exact export the patched video paths now call (readProviderJsonResponse).
  • Exact steps:
    1. Loopback server streams ~20 MiB of an open JSON object body (no Content-Length).
    2. fetch() the body over TCP, then call readProviderJsonResponse(response, label) with the same labels the patched MiniMax video sites pass.
    3. Assert it throws ... JSON response exceeds 16777216 bytes and that the client cancelled the socket before the full body was delivered.
    4. Negative control: emulate the removed unbounded await response.json() path and confirm it buffers past the 16 MiB cap.
    5. Happy path: a small JSON object still parses correctly through the bounded reader.
  • Observed result: bounded throw fires, the socket is aborted, the server never delivers the full body, the unbounded control buffers past the cap, and the happy path parses. See Evidence.
  • What was not tested: no live calls to the real MiniMax API (no credentials); loopback upstream proof exercises the real TCP + fetch + reader path.

Evidence

Original loopback proof:

$ node --import tsx proof-minimax-bound.mts
PASS: [MiniMax video generation failed] bounded throw on oversize stream -- msg="MiniMax video generation failed: JSON response exceeds 16777216 bytes"
PASS: [MiniMax video generation failed] stream cancelled (socket aborted by client) -- aborted=true
PASS: [MiniMax video generation failed] bytesSent (18808858) < full body (20971520) -- bytesSent=18808858
PASS: negative control: unbounded read buffers PAST the 16 MiB cap -- buffered=16823166 > cap=16777216
PASS: happy path: small JSON parses through bounded reader -- parsed.task_id=task-123

ALL PROOFS PASSED

Refreshed current-head focused regression after adding the file_id metadata bound and narrowing this PR to MiniMax video:

$ node scripts/run-vitest.mjs extensions/minimax/video-generation-provider.test.ts -- --run

 Test Files  1 passed (1)
      Tests  6 passed (6)
$ git diff --check
# no output

Known validation note: node scripts/run-tsgo.mjs -p extensions/minimax/tsconfig.json --incremental false currently fails in existing extensions/minimax/oauth.ts imports from openclaw/plugin-sdk/number-runtime; that file is outside this PR's touched surface.

Label: security

AI-assisted.


Post-rebase scope note: This PR is video-only and unchanged in intent. The MiniMax image-response bound referenced above as "future work" has since landed on main, so there is no remaining image hunk here — this PR bounds only the three MiniMax video success/control JSON reads (video-generation-provider.ts: task submit, status poll, and file_id metadata).

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.
@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 10:48 AM ET / 14:48 UTC.

Summary
The PR routes MiniMax video task-submit, status-poll, and file-metadata JSON responses through readProviderJsonResponse and updates MiniMax video tests to exercise real Response bodies.

PR surface: Source +14, Tests +47. Total +61 across 3 files.

Reproducibility: yes. source-reproducible with high confidence: current main directly buffers untrusted MiniMax video success/control JSON responses with response.json(). I did not run a local repro because this review is read-only, but the PR body provides loopback TCP proof and a negative unbounded control.

Review metrics: 1 noteworthy metric.

  • MiniMax video JSON reads: 3 bounded, 0 config/default surfaces changed. The measured surface matches the claimed task-submit, status-poll, and file-metadata control paths without changing user configuration or defaults.

Stored data model
Persistent data-model change detected: serialized state: extensions/minimax/video-generation-provider.test.ts, vector/embedding metadata: extensions/minimax/video-generation-provider.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: canonical
Canonical: #96889
Summary: This PR is the canonical current item for MiniMax video control JSON response bounding; related PRs are adjacent members of the broader provider-response hardening campaign.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • No ClawSweeper repair job is needed because there are no actionable patch findings; maintainer review and required checks should decide merge.

Security
Cleared: The diff reduces an unbounded-response risk using an existing helper and does not add dependencies, workflows, scripts, secrets handling, lockfile changes, or new code-execution surfaces.

Review details

Best possible solution:

Land this focused video-control hardening after maintainer review and required checks; keep image sizing on the merged image-generation path and handle OAuth/VLM through their separate PRs.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible with high confidence: current main directly buffers untrusted MiniMax video success/control JSON responses with response.json(). I did not run a local repro because this review is read-only, but the PR body provides loopback TCP proof and a negative unbounded control.

Is this the best way to solve the issue?

Yes: reusing openclaw/plugin-sdk/provider-http’s bounded JSON reader is the narrow SDK-boundary fix, avoids plugin-local duplicate limit logic, and leaves adjacent image/OAuth/VLM surfaces to their own scoped work.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9241b9701d9c.

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦀 challenger crab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: The PR addresses a provider response path where a hostile or broken upstream can stream oversized JSON and hang or exhaust process memory.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal proof from a real loopback TCP server streaming oversized chunked JSON, plus a negative unbounded control and focused MiniMax video test output; the prepared media manifest only failed to fetch the placeholder example URL and is not needed for this proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal proof from a real loopback TCP server streaming oversized chunked JSON, plus a negative unbounded control and focused MiniMax video test output; the prepared media manifest only failed to fetch the placeholder example URL and is not needed for this proof.
Evidence reviewed

PR surface:

Source +14, Tests +47. Total +61 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 41 27 +14
Tests 1 85 38 +47
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 126 65 +61

What I checked:

  • Current main still has unbounded MiniMax video JSON reads: MiniMax video status polling, file metadata retrieval, and task submission success handling still call response.json()/metadataResponse.json() directly on current main. (extensions/minimax/video-generation-provider.ts:203, 9241b9701d9c)
  • PR replaces the three video control reads with the bounded helper: The final PR patch imports readProviderJsonResponse and applies it to the status-poll, file-metadata, and task-submit response bodies while leaving the image provider out of the branch. (extensions/minimax/video-generation-provider.ts:201, 2149eff05f08)
  • Shared helper enforces the JSON byte cap: readProviderJsonResponse defaults to the 16 MiB provider JSON cap and delegates to readResponseWithLimit, which throws JSON response exceeds ... bytes on overflow. (src/agents/provider-http-errors.ts:312, 9241b9701d9c)
  • MiniMax image hardening is already separate on main: Current main uses an image-sized readProviderJsonResponse cap for MiniMax image generation, so the earlier image hunk is correctly not part of this video-only branch. (extensions/minimax/image-generation-provider.ts:182, 9241b9701d9c)
  • Related search shows adjacent, not superseding, work: GitHub search found open MiniMax OAuth/VLM response-bound PRs and the merged image-generation hardening PR; none replaces this MiniMax video control fix.
  • History points to current MiniMax video surface introduction: Blame and log show the current MiniMax video provider/test/helper files were introduced in commit 84bcd50. (extensions/minimax/video-generation-provider.ts:203, 84bcd500c974)

Likely related people:

  • Jaaneek: The current MiniMax video provider, tests, and provider HTTP test helper blame to commit 84bcd50, authored by Milosz Jankiewicz with the Jaaneek GitHub noreply identity. (role: introduced current MiniMax video surface; confidence: high; commits: 84bcd500c974; files: extensions/minimax/video-generation-provider.ts, extensions/minimax/video-generation-provider.test.ts, extensions/minimax/provider-http.test-helpers.ts)
  • Alix-007: The related merged provider JSON hardening PR introduced the bounded helper this PR reuses, and live PR metadata ties that merge commit to Alix-007. (role: shared bounded-reader contributor; confidence: medium; commits: 2592f8a51a4e; files: src/agents/provider-http-errors.ts, src/agents/provider-http-errors.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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 keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 26, 2026
@Alix-007

Copy link
Copy Markdown
Contributor Author

Updated the PR body and branch for the ClawSweeper finding: the MiniMax video file_id metadata response now uses readProviderJsonResponse, the video tests keep the real bounded reader via importActual, and the focused metadata-overflow regression passes.\n\nVerified current head:\n- node scripts/run-vitest.mjs extensions/minimax/video-generation-provider.test.ts -- --run\n- git diff --check\n\n@clawsweeper re-review

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jun 26, 2026
@Alix-007

Copy link
Copy Markdown
Contributor Author

Addressed the latest ClawSweeper blocker by narrowing this PR back to MiniMax video/control JSON only. The MiniMax image-provider change has been removed from this branch so image-sized response caps can be handled by the broader image-response hardening work without this PR imposing the generic 16 MiB JSON cap on inline base64 image responses.

Verified current head:

  • node scripts/run-vitest.mjs extensions/minimax/video-generation-provider.test.ts -- --run
  • git diff --check

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 26, 2026
@Alix-007 Alix-007 changed the title fix(minimax): bound image/video success response reads fix(minimax): bound video control response reads Jun 26, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 26, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jun 26, 2026
Alix-007 added 2 commits June 27, 2026 07:35
MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.
@Alix-007
Alix-007 force-pushed the fix/bound-minimax branch from 5642ef4 to 3679161 Compare June 27, 2026 00:15
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 27, 2026
@sallyom sallyom self-assigned this Jun 28, 2026
@Alix-007

Copy link
Copy Markdown
Contributor Author

Updated this branch against latest upstream main to refresh the cancelled QA Smoke run and clear post-merge drift. The MiniMax video-control patch itself was unchanged.

Verified current head locally:

  • node scripts/run-vitest.mjs extensions/minimax/video-generation-provider.test.ts -- --run
  • git diff --check

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦀 challenger crab Exceptional PR readiness: strong proof, clean patch, and convincing validation. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jun 28, 2026
@sallyom

sallyom commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Merge-ready for 2149eff.

Local review of the updated head and ClawSweeper review clean, CI green, best narrow fix, and follows the established bounded provider JSON response-read pattern. The branch now stays correctly scoped to MiniMax video/control JSON only: task submit, status poll, and file_id metadata are bounded with readProviderJsonResponse, while the image inline-base64 response cap concern is left out of this PR. The test helper keeps the real bounded reader via importActual, and the focused regression covers oversized file_id metadata JSON failing before any binary download attempt. No maintainer edits needed.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦀 challenger crab Exceptional PR readiness: strong proof, clean patch, and convincing validation. labels Jun 28, 2026
@sallyom
sallyom merged commit 25e184a into openclaw:main Jun 28, 2026
106 of 110 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 29, 2026
* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads

* fix(minimax): leave image response sizing to image hardening

* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads
QiuYuang pushed a commit to QiuYuang/openclaw that referenced this pull request Jul 1, 2026
* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads

* fix(minimax): leave image response sizing to image hardening

* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 1, 2026
* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads

* fix(minimax): leave image response sizing to image hardening

* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads
Rorqualx pushed a commit to Rorqualx/cortex that referenced this pull request Jul 2, 2026
* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads

* fix(minimax): leave image response sizing to image hardening

* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads

(cherry picked from commit 25e184a)
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 3, 2026
* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads

* fix(minimax): leave image response sizing to image hardening

* fix(minimax): bound image/video success response reads

MiniMax image generation and video generation (task submit + status poll)
read their success responses through unbounded `await response.json()`, so
a misbehaving or hostile endpoint could stream an arbitrarily large body
into memory before parsing and exhaust the process. Read those success
bodies through the shared bounded reader (16 MiB cap, the same limit other
bundled providers and the sibling MiniMax web-search provider already use)
and cancel the stream on overflow. The error-body path is already bounded
via assertOkOrThrowHttpError; this closes the matching success-JSON gap.
MiniMax TTS is already bounded and is left unchanged.

AI-assisted.

* fix(minimax): bound video metadata response reads
LeonidasLux added a commit to LeonidasLux/openclaw that referenced this pull request Jul 7, 2026
… OOM

Replace unbounded `response.json()` in `callUserTokenService` with
`readProviderJsonResponse(response, "msteams.sso-user-token")` —
the same shared bounded reader already deployed across the codebase
(openclaw#95218, openclaw#96322, openclaw#96495, openclaw#96889). Enforces a 16 MiB default cap
and cancels the underlying stream on overflow.

Closes the last unbounded JSON read on the MSTeams SSO token-exchange
path. Error responses were already bounded via `extractProviderErrorDetail`.

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: minimax P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants