Repository navigation
Conversation
1741b01 to
61991e7
Compare
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the same OpenAI ChatGPT OAuth token-response OOM work is already owned by #98113, which is proof-positive, broader, and has maintainer validation, while this branch still has a type-checking defect and weaker path-level proof. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this branch and keep #98113 as the canonical landing path for the OpenAI ChatGPT OAuth response-boundary fix. So I’m closing this here and keeping the remaining discussion on #98113. Review detailsBest possible solution: Close this branch and keep #98113 as the canonical landing path for the OpenAI ChatGPT OAuth response-boundary fix. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection on current main shows postTokenForm still uses an unbounded response.arrayBuffer() on the guarded token response before release; I did not run a live endpoint repro for this read-only cleanup review. Is this the best way to solve the issue? No as a landing path. The branch is a plausible mitigation, but #98113 is the better solution because it covers the first-read boundary plus downstream exchange/refresh JSON and error reads with stronger proof. Security review: Security review cleared: Cleared: the diff hardens an OAuth token response read and adds no dependency, workflow, credential, package, lockfile, or supply-chain execution surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 2f7299eaa575. |
61991e7 to
edc6d9a
Compare
|
@clawsweeper re-review\n\nAdded a real behavior proof script and updated the PR body with the proof output. Branch rebased onto latest upstream/main. |
|
Superseded by #99479, landed as The landed fix bounds the single shared upstream Thanks @cxbAsDev for addressing this class of issue. Closing in favor of the landed canonical implementation. |
What Problem This Solves
postTokenFormin the OpenAI Codex OAuth flow buffered the entire token exchange / refresh response into anarrayBufferbefore re-wrapping it as aResponse. A malicious or misbehaving token endpoint could stream an unbounded JSON payload and force the CLI to buffer it all, leading to OOM.Why This Change Was Made
Use the repo's existing bounded provider HTTP helpers (
readProviderJsonResponse/readResponseTextLimited) to cap the successful token JSON body at 1 MiB and error diagnostic bodies at 8 KiB. This mirrors the already-landed fixes for OpenRouter OAuth (#98645), Google OAuth (#97587), and QA bus JSON responses (#99169).User Impact
openclaw auth openai(ChatGPT OAuth) is protected against runaway token endpoint responses.Evidence
extensions/openai/openai-chatgpt-oauth-flow.runtime.test.ts: it feeds a >1 MiB JSON payload toexchangeAuthorizationCodeand asserts the result is a boundedfailedresponse.scripts/proof/openai-chatgpt-oauth-json-bound.mtsthat serves an 8 MiB JSON body from a local HTTP server and verifiesreadProviderJsonResponserejects at the 1 MiB cap before buffering everything.node scripts/run-vitest.mjs extensions/openai/openai-chatgpt-oauth-flow.runtime.test.tspasses.OPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/run-oxlint.mjs extensions/openai/openai-chatgpt-oauth-flow.runtime.ts extensions/openai/openai-chatgpt-oauth-flow.runtime.test.ts scripts/proof/openai-chatgpt-oauth-json-bound.mtspasses.node --import tsx scripts/proof/openai-chatgpt-oauth-json-bound.mtspasses.Proof output