Commit 7659f3c
authored
fix(ext/node): normalize trailing dot in TLS servername (#32166)
Fixes #30170
Node.js strips trailing dots from FQDN server names before TLS
certificate verification, but Deno was passing the servername with the
trailing dot directly to rustls. This caused certificate validation
failures when connecting with a trailing-dot servername like
`example.local.` to a server whose certificate is valid for
`example.local`.
The error message was especially confusing because it said the
certificate wasn't valid for `example.local.` when it was only valid for
`example.local.` (same string):
```
certificate not valid for name "example.local."; certificate is only valid for DnsName("example.local.")
```
The fix strips the trailing dot from the hostname in the TLSSocket
constructor before it's passed to the TLS layer. This matches Node.js
behavior - DNS fully-qualified domain names end with a dot but TLS SNI
extensions and certificate matching should work without it.
Added a test that connects using `localhost.` as servername to verify
the trailing dot is properly normalized.1 parent a8f201f commit 7659f3c
2 files changed
+47
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
91 | 97 | | |
92 | 98 | | |
93 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
0 commit comments