Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 7:08 AM ET / 11:08 UTC. Summary PR surface: Source +33, Tests +107. Total +140 across 2 files. Reproducibility: yes. Current main and v2026.6.10 both show postTokenForm using raw response.arrayBuffer() before release(), so an oversized token endpoint body can be buffered before downstream parsing sees it. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Land the bounded OpenAI OAuth response-read change after ordinary maintainer and CI gates, keeping the cap at the token fetch boundary and retaining the focused regression coverage. Do we have a high-confidence way to reproduce the issue? Yes. Current main and v2026.6.10 both show postTokenForm using raw response.arrayBuffer() before release(), so an oversized token endpoint body can be buffered before downstream parsing sees it. Is this the best way to solve the issue? Yes. Capping the guarded token response before release() is the right owner-boundary fix; capping only response.json() or diagnostic text would leave the original body-buffering path exposed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 738b2be4b49b. Label changesLabel justifications:
Evidence reviewedPR surface: Source +33, Tests +107. Total +140 across 2 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
|
f68614e to
11c3526
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
11c3526 to
259deee
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
9072d9c to
cf4f4c7
Compare
exchangeAuthorizationCode and refreshAccessToken called response.json() and response.text() without size limits on the token endpoint response. Replace with readProviderJsonResponse (16 MiB capped JSON parse) and readResponseTextLimited (16 MiB capped text read). Co-Authored-By: Claude <[email protected]>
cf4f4c7 to
d59938a
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
Maintainer landing validation is complete for
A maintainer-local test-only patch adds exact oversized/malformed/bodyless/cancellation/release/diagnostic-cap assertions. It is intentionally not on the contributor branch yet and is ready for the manager-controlled serialized prepare step. No real OAuth credentials were used or exposed; the contributor's loopback proof and hostile-stream tests cover the response boundary. |
|
Superseded by #99479, landed as The landed fix bounds the single shared upstream Thanks @solodmd for addressing this class of issue. Closing in favor of the landed canonical implementation. |
What Problem This Solves
postTokenForminextensions/openai/openai-chatgpt-oauth-flow.runtime.tsreads the OpenAI Codex OAuth token endpoint response body with an unbounded
await response.arrayBuffer(). A compromised or hijacked OAuth endpoint canstream an arbitrarily large body and force the runtime to buffer the entire
payload — an OOM/DoS vector.
Changes
extensions/openai/openai-chatgpt-oauth-flow.runtime.ts— importreadResponseWithLimitfromopenclaw/plugin-sdk/response-limit-runtime;replace
await response.arrayBuffer()withreadResponseWithLimitat 16MiB cap inside
postTokenForm, beforerelease(). Also replaceresponse.json()andresponse.text()inexchangeAuthorizationCodeandrefreshAccessTokenwithreadProviderJsonResponseandreadResponseTextLimitedfor defense-in-depth. Use a small diagnostic cap(4 KB) for failed-exchange and failed-refresh error text reads.
extensions/openai/openai-chatgpt-oauth-flow.runtime.test.ts— 5 new testscovering oversized exchange, oversized refresh, malformed JSON, and error
body bounding for both exchange and refresh paths.
Evidence
Real behavior proof
The proof script exercises the exact bounded read that
postTokenFormperforms on real loopback HTTP wire —
readResponseWithLimitat 16 MiB capbefore
release()— plus thereadProviderJsonResponsecall thatexchangeAuthorizationCodeandrefreshAccessTokenuse on the bounded clone,each with its own distinct label:
A loopback HTTP server streams an oversized body (18 MiB over 16 MiB cap)
and valid/malformed JSON responses.
readResponseWithLimitdetects overflowat 16 MiB and cancels the stream;
readProviderJsonResponsevalidates JSONparsing on the bounded clone.
Tests
postTokenFormlevel),oversized token refresh, malformed JSON rejection, capped error body on
failed exchange, and capped error body on failed refresh.
timeout, cancellation, unsafe lifetime rejection all pass.
pnpm test extensions/openai/openai-chatgpt-oauth-flow.runtime.test.ts→15 passed (15)