fix: MAX_BUFFER_SIZE guard for chunked responses + bump fast-proxy-lite 1.1.3#104
Merged
Merged
Conversation
…oxy-lite to 1.1.3 - Add 1MB buffer limit in default onResponse hook to prevent OOM from unbounded chunked upstream responses when Connection: close - Bump fast-proxy-lite ^1.1.2 -> ^1.1.3 for SSRF fix (absolute URL blocking) - Add regression tests for buffer overflow protection - Remove unused stream-to-array import
jkyberneees
approved these changes
May 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two security hardening changes:
1. Buffer overflow protection for chunked responses (🔴 Moderate)
default-hooks.js — The
onResponsehandler buffered unbounded chunked responses into memory whenConnection: closewas set. A malicious or misconfigured upstream could exhaust the gateway process memory.Fix: Added a 1MB
MAX_BUFFER_SIZEguard that tracks accumulated buffer size during chunk collection. When exceeded, the stream is destroyed and a 502 Bad Gateway is returned instead of OOM-ing the process.stream-to-arrayimport (replaced withfor awaititerator)2. Bump fast-proxy-lite ^1.1.2 → ^1.1.3
Pulls in the SSRF fix:
buildURL()now validates origin, blocking absolute-form HTTP requests that bypass the configured base URL.Test Plan
New tests
large chunked rejected with 502 when Connection close (buffer limit)— 2MB chunked response withConnection: close→ 502large chunked streamed normally when Connection keep-alive— 2MB chunked with keep-alive → 200 (no buffering)Existing tests preserved
Files Changed
lib/default-hooks.jspackage.jsontest/smoke.test.js