Skip to content

tls: ignore a terminal dot when matching SNI contexts - #67639

Open
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:tls-sni-terminal-dot
Open

ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:tls-sni-terminal-dot

Conversation

@ShogunPanda

Copy link
Copy Markdown
Contributor

server.addContext() and the SNI callback compared the names as written, so a client sending host.example. (with a terminal dot) did not match a context registered for host.example, and vice versa, although both names refer to the same host. Remove one terminal dot from both sides before matching so the same context is selected.

Testing: added test/parallel/test-tls-sni-trailing-dot.js (TLSv1.2 and TLSv1.3, exact and wildcard names, with and without the terminal dot). The parallel/test-tls-* and parallel/test-https-* suites and eslint pass.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem. labels Nov 20, 2026
The names given to `server.addContext()` and the server name sent by
the client were compared as written, so `host.example.` did not match
a context added for `host.example`, although both name the same host.
Remove one terminal dot from both before matching, so that the same
context is selected.

Assisted-By: OpenAI GPT-5.6 Sol <openai/gpt-5.6-sol>
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.72%. Comparing base (0482448) to head (2139721).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67639      +/-   ##
==========================================
- Coverage   90.72%   90.72%   -0.01%     
==========================================
  Files         801      801              
  Lines      280889   280918      +29     
  Branches    54240    54256      +16     
==========================================
+ Hits       254829   254852      +23     
- Misses      16245    16249       +4     
- Partials     9815     9817       +2     
Files with missing lines Coverage Δ
lib/internal/tls/wrap.js 95.82% <100.00%> (+0.02%) ⬆️

... and 30 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants