Repository navigation
fix: keep undici and got requests on the configured proxy - #82
Merged
Merged
Conversation
Undici now wraps origin TLS on the CONNECT socket instead of dialing the target directly. Got rejects HTTP URLs and HTTPS-to-HTTP redirects so they cannot fall back to a direct connection. Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>
The security fix already accepts connectTimeout on the undici request options. Document it beside tlsOptions so the public API matches the types. Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>
…agent-memory-9801 Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>
…agent-memory-9801 Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>
Collaborator
|
bugbot review |
Contributor
Author
|
Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings. |
Client connectTimeout is ignored when connect is a custom function, so a hung origin handshake waited the connector default of 10s. Bytes that arrived with the CONNECT response were unshifted on a still-flowing socket, which dropped them before origin TLS. Co-authored-by: ProxyMesh AI <proxymeshai@users.noreply.github.com>
proxymeshai
marked this pull request as ready for review
November 1, 2026 21:08
Contributor
Author
|
Review of the undici/got proxy-bypass fix. The bypass is closed. Undici HTTPS wraps origin TLS on the CONNECT socket ( Two undici correctness bugs, fixed in 08a8fca:
|
proxymesh
approved these changes
Nov 2, 2026
proxymesh
enabled auto-merge
November 2, 2026 22:08
proxymesh
disabled auto-merge
November 2, 2026 22:11
4 tasks done
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.
Fixes two proxy-bypass issues from the at-rest security scan.
Undici: HTTPS
request()sent CONNECT, then ignored the tunnel and dialed the origin directly (connect: { socket }is not undici’s tunnel API). Origin TLS now wraps the CONNECT socket viahttpSocket.Got: Only
agent.httpswas set, sohttp://URLs and HTTPS→HTTP redirects used got’s default HTTP agent and connected directly. The adapter now rejects HTTP and protocol-downgrade redirects, and pinsagent.httpso a missed hook cannot fall back to a direct connect.Unit tests cover:
npm run test:unitpasses (20 tests).Fixes two proxy-bypass issues from the at-rest security scan. This PR is only that security fix: undici and got stay on the configured proxy. No dependency bumps, no peer or engine changes.
Undici
HTTPS
request()completed CONNECT, then ignored the tunnel and dialed the origin directly.connect: { socket }is a TLS option, not undici’s pre-connected tunnel API. Origin TLS is now wrapped on the CONNECT socket withbuildConnectorandhttpSocket.tlsOptionsis passed into that connector.connectTimeoutbounds the origin handshake, which the “CONNECT not forwarded” test uses so a hung tunnel cannot fall through to a direct dial.proxyTlsOptionswas already accepted and is now documented.Got
Only
agent.httpswas set, sohttp://URLs and HTTPS→HTTP redirects used got’s default HTTP agent and connected directly. The adapter rejects those URLs and pinsagent.httpto the same proxy agent so a missed hook cannot fall back to a direct connect.Tests in CI
npm run test:unitisnode --test test/test_connect_security.js. New cases:The Proxy integration tests workflow already runs
npm run test:unitonubuntu-24.04(actions pinned by commit SHA) before the livePROXY_URLsuite. No new workflow was added.Files
lib/undici-proxy.js,lib/got-proxy.js— the fixtypes/undici.d.ts,test/types.test.ts—tlsOptionsandconnectTimeoutdocs/undici.md,docs/got.md,docs/getting-started.md— the behavior and the new optionstest/test_connect_security.js— the four cases above