Repository navigation
Conversation
The experimental Milo parser missed both parts of the GHSA-35p6-xmwp-9g52 fix that the llhttp parser has: - it never set kSocketUsed, which was private to client-h1.js, so the idle socket validation never ran before an idle socket was reused; - it did not reject a response that starts while no request is running, so buffered unsolicited bytes were attributed to the request queued next. Move kSocketUsed to core/symbols.js and set it when a Milo response completes, as the llhttp parser does. Reject a response that starts, or completes its headers, while no request is running, with the same 'bad response' SocketError. Refs: GHSA-35p6-xmwp-9g52 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sfj4nEWQ4ovycNDjbvXcRs Signed-off-by: Matteo Collina <hello@matteocollina.com>
ShogunPanda
approved these changes
Nov 13, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6205 +/- ##
==========================================
+ Coverage 91.67% 91.76% +0.08%
==========================================
Files 113 113
Lines 44438 44457 +19
==========================================
+ Hits 40740 40797 +57
+ Misses 3698 3660 -38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
The experimental Milo HTTP/1.1 parser (
useMilo/UNDICI_USE_MILO) missed both parts of the GHSA-35p6-xmwp-9g52 fix that the llhttp parser has:resumeH1validates an idle socket before reusing it only ifsocket[kSocketUsed]is set. That symbol was private toclient-h1.js, soparser-h1.jsnever set it, and with Milo an idle socket was reused without validation. This came up in fix(h1): do not reuse idle sockets whose keep-alive timeout expired #6171.SocketError('bad response')when a response starts while no request is running (onMessageBeginandonHeadersComplete). Milo had no such check. While a request is queued but not yet written,client[kQueue][client[kRunningIdx]]is that request, so buffered unsolicited response bytes were attributed to it.Changes
kSocketUsedtolib/core/symbols.js, and set it when a Milo response completes, as the llhttp parser does.'bad response'error as llhttp.Both changes are needed. With only
kSocketUsedset, the validation reads the unsolicited response before the next request is written, but Milo still attributes it to the queued request and fails an internal assertion (assert(this.timeoutType === TIMEOUT_HEADERS)). With the guard as well, the socket is destroyed and the request is sent on a new connection, as with llhttp.Testing
test/response-queue-poisoning.jsgains a test for both parsers. An unsolicited response reaches the client's receive buffer just before the next request is dispatched, and the test checks that the request does not receive it. Onmain, the llhttp case passes and the Milo case fails (the request gets the unsolicited response); with this change, both pass.test/response-queue-poisoning.js,test/client-keep-alive.js,test/client-pipelining.js,test/issue-810.jsandtest/node-test/keep-alive-reuse.jspass with both parsers (43/43 each).test/*.jswithUNDICI_USE_MILO=1, and a benchmark of the Milo path, are in progress; their results will be added here.🤖 Generated with Claude Code
https://claude.ai/code/session_01Sfj4nEWQ4ovycNDjbvXcRs