Repository navigation
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Thanks for the context here. I did a careful shell check against current Current Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep current Do we have a high-confidence way to reproduce the issue? Yes. The pre-fix unbounded Is this the best way to solve the issue? No, this branch is no longer the best solution. Current Security review: Security review cleared: The diff adds no dependency, workflow, permission, secret, or supply-chain surface; the security-relevant memory protection is already present on current AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against d11d1d0ee64d; fix evidence: commit aaf5ab910cbe, main fix timestamp 2026-07-05T23:08:51Z. |
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
f7473af to
dfcb769
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Replace unbounded response.arrayBuffer() with readResponseWithLimit capped at 16 MiB. Add decoded-output cap after gunzipSync and use bounded gunzip (maxOutputLength) to prevent compressed overflow OOM. - readResponseWithLimit for wire-level cap (16 MiB) - MAX_DECODED_TOKEN_BODY_BYTES post-gunzip safety check - maxOutputLength option for Node 22+ bounded decompression - 10 boundary tests: valid JSON, empty, invalid, gzip, oversized, near-boundary, non-streaming fallback, whitespace-only - Handle Node 24 ERR_BUFFER_TOO_LARGE from gunzipSync Ref. #98507
|
ClawSweeper applied the proposed close for this PR.
|
What Problem This Solves
The
readGoogleOauthTokenResponsePayloadfunction invertex-adc.tsbuffers the full Google OAuth token response before parsing. A malicious or misconfigured OAuth endpoint could send a very large response, causing the gateway process to run out of memory.This is the same class of issue as #98424 but in the Google Vertex token-refresh path.
Why This Change Was Made
The original code used
response.arrayBuffer()which buffers the entire response body in memory before parsing. This PR replaces that withreadResponseWithLimitfrom the plugin SDK, which uses a streaming reader with a 16 MiB byte cap.Changes in this iteration (v3)
Replaced ISIZE pre-check with bounded gunzip (
maxOutputLength):gunzipSync(bytes, { maxOutputLength })which limits decompression output at the zlib layer before full allocationFixed
content-encodingheader handling:content-encodingheader fallback fromshouldGunzipGoogleOauthTokenResponsecontent-encoding: gzipon the response, causinggunzipSyncto fail on already-decompressed data0x1f 0x8b) to decide whether to decompressChanges in this iteration (v4)
Node 24 compatibility - gzip overflow error code:
gunzipSyncthrowsERR_BUFFER_TOO_LARGE(RangeError) whenmaxOutputLengthis exceeded, notERR_ZLIB_OUTPUT_LENGTH_EXCEEDEDas on Node <24Removed proof script & added focused regression tests:
scripts/proof-real-behavior.mjs(the inlined proof script)extensions/google/vertex-adc.test.tswith 11 focused tests covering all bounded-read and overflow scenariosUser Impact
None under normal operation. ADC token responses are typically < 10 KiB. The 16 MiB cap is far above any legitimate response size.
Evidence
Real behavior proof — production module via HTTP (Node 24.18.0)
Imports
readGoogleOauthTokenResponsePayloadfrom the actual built production module (dist/extensions/google/vertex-adc.js) and exercises it against a local HTTP server with realfetch()requests — no inline implementation, no mocking.Unit tests (focus on bounded read behavior)
11 dedicated regression tests in
extensions/google/vertex-adc.test.ts:Key findings
maxOutputLengthoption on both Node <24 (ERR_ZLIB_OUTPUT_LENGTH_EXCEEDED) and Node 24+ (ERR_BUFFER_TOO_LARGE)error_descriptionparsed correctly