Repository navigation
fix(tls): omit SNI for absent and null servernames - #171
Merged
Merged
Conversation
Keep raw tls.connect SNI explicit, preserve higher-level HTTPS and HTTP/2 name selection, and report false for established sockets without SNI. Adapts oven-sh#33476 and oven-sh#39088 by @robobun. Node 24.21.0 matrix and downstream TLS identity scoping pass.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Oct 14, 2026
steipete
added a commit
to steipete/bun
that referenced
this pull request
Oct 28, 2026
Pass an explicit empty native name when tls.connect has no servername, while preserving pending setServername state and hostname verification. Keep HTTP/2 authority defaults in the HTTP/2 adapter and report false on established client sockets without SNI. Supersedes stale oven-sh#33476 by robobun; thanks @robobun. Ports openclaw#171. Related to the unwanted SNI in oven-sh#20727.
steipete
added a commit
to steipete/bun
that referenced
this pull request
Nov 14, 2026
Pass an explicit empty native name when tls.connect has no servername, while preserving pending setServername state and hostname verification. Keep HTTP/2 authority defaults in the HTTP/2 adapter and report false on established client sockets without SNI. Supersedes stale oven-sh#33476 by robobun; thanks @robobun. Ports openclaw#171. Related to the unwanted SNI in oven-sh#20727.
steipete
added a commit
to steipete/bun
that referenced
this pull request
Nov 21, 2026
Pass an explicit empty native name when tls.connect has no servername, while preserving pending setServername state and hostname verification. Keep HTTP/2 authority defaults in the HTTP/2 adapter and report false on established client sockets without SNI. Supersedes stale oven-sh#33476 by robobun; thanks @robobun. Ports openclaw#171. Related to the unwanted SNI in oven-sh#20727.
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.
What does this PR do?
Fixes
tls.connect({ host: "127.0.0.1", servername: null })sending127.0.0.1as SNI. A null name reached the native connection-host fallback. The Node TLS adapter now supplies an empty native name for absent/null/empty servernames and leaves certificate verification bound to the explicit name or connection host. Established Node sockets reportfalsewhen no SNI was sent.Direct
tls.connect()does not infer SNI from a DNS host either. HTTPS agents already select it themselves; HTTP/2 now derives its name from the authority at its own layer. Existing option-normalization tests explicitly request the SNI name they assert.Adapts the SNI layering fix from oven-sh/bun#33476 and the no-SNI socket property correction from oven-sh/bun#39088. Thanks @robobun! Neither proposal was merged; both were closed during stale-PR cleanup. Related #37013 covers embedded NUL validation and #42766 covers SQL IP names, separate contracts.
Node 24.21.0 sends an explicitly requested IP servername with
DEP0123. This change preserves Bun's existing explicit-IP rejection; it fixes unintended SNI from absent names.How did you verify your code works?
The built-ins-only fixture runs unchanged under Node 24.21.0. Its 34 cases cover direct IP/DNS TLS, socket upgrades, secure contexts, HTTPS agents, and HTTP/2. Each checks server-observed SNI, client
servername, verification hostname, and authorization.On a native Linux x64 release build:
extensions/openai/image-generation-provider.tls.test.tson the same downstream source: unpatched fork 1 pass / 2 fail (cross-origin and redirect scoping); patched fork 3/3 pass; Node 24.21.0 3/3 pass. Each run used isolated state.openclaw/mainpass.The internal-test environment enables
bun:internal-for-testing; it does not alter the SNI fix or test assertions. The implementation touches only portable JavaScript adapters, with no platform-specific TLS changes.Commands for the focused regression and downstream consumer:
node test/js/node/tls/node-tls-servername-fixture.mjs bun run build:release test test/js/node/tls/node-tls-connect-hostname-verification.test.ts OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-provider-openai.config.ts extensions/openai/image-generation-provider.tls.test.tsFork CI passed on Linux x64 and macOS arm64: native build-and-test run. All 65 Linux and 66 macOS selected files passed, including the regression file, plus both direct net checks. Formatting and JavaScript lint passed. The unrelated issue-finder bot failed before analysis because its workflow lacks an Anthropic credential.