Repository navigation
tls: ignore a terminal dot when matching SNI contexts - #67639
ShogunPanda wants to merge 1 commit into
Conversation
|
Review requested:
|
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>
a6e9a38 to
2139721
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
jasnell
left a comment
There was a problem hiding this comment.
LGTM but a decision about whether this neesd to be semver-major or not needs to be made.
pimterry
left a comment
There was a problem hiding this comment.
LGTM.
I don't think this is semver major, seems like a reasonable bug fix to me, and we've certainly never documented or expected the old behaviour. And this is a patch for an invalid edge case anyway, the SNI spec forbids this entirely, so normal clients should never send it:
The hostname is represented as a byte string using ASCII encoding without a trailing dot.
Happy to bake for LTS if we'd like, but I'm not too worried.
server.addContext()and the SNI callback compared the names as written, so a client sendinghost.example.(with a terminal dot) did not match a context registered forhost.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). Theparallel/test-tls-*andparallel/test-https-*suites and eslint pass.