mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
Inbound DATA frames delivered to JS while a stream is paused are retained in the stream's readable buffer until the application reads them. These were not counted against the session's maxSessionMemory, so a peer could send many tiny DATA frames on a stream the application is not draining and make the session retain an unbounded amount of memory, in proportion to the number of frames rather than the bytes sent. Charge each such DATA chunk (plus a per-chunk overhead comparable to the Buffer view bookkeeping) against maxSessionMemory, and release it when the stream resumes reading (ReadStart) or is destroyed (RemoveStream). Add connection-level backpressure so the session stops reading from the socket once it can no longer afford the inbound queued data, resuming when the application consumes it. Refs: https://hackerone.com/reports/4089663 Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs-private/node-private/pull/1000 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> CVE-ID: CVE-2026-123868