Skip to content

Commit 6f5a7cd

Browse files
committed
doc: clarify tlsSocket.authorized on resumption
The peer certificate is not verified again when a connection resumes a TLS session. When the original handshake included a client certificate, authorized and authorizationError carry the verification result stored with the session; on TLS 1.3, a client that sent no certificate can resume a session and report authorized as true. Document this and point manual-authorization servers at isSessionReused() and getPeerCertificate(). Fixes: #35317 Signed-off-by: Julian Soreavis <julian.soreavis@gmail.com>
1 parent 39f427d commit 6f5a7cd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

doc/api/tls.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,18 @@ added: v0.11.4
10721072
This property is `true` if the peer certificate was signed by one of the CAs
10731073
specified when creating the `tls.TLSSocket` instance, otherwise `false`.
10741074

1075+
The peer certificate is only verified during a full TLS handshake. When a
1076+
connection is established by resuming a previous session (see
1077+
[Session Resumption][]), verification is not repeated. If the client
1078+
presented a certificate in the original handshake, `authorized` and
1079+
`authorizationError` carry the result stored with the session, including
1080+
any verification error. On TLS 1.3, a client that sent no certificate at
1081+
all can resume a session and report `authorized` as `true`, while
1082+
[`tls.TLSSocket.getPeerCertificate()`][] returns an empty object. Servers
1083+
that authorize clients manually with `rejectUnauthorized: false` should
1084+
therefore also check [`tls.TLSSocket.isSessionReused()`][] and that a peer
1085+
certificate is present.
1086+
10751087
### `tlsSocket.disableRenegotiation()`
10761088

10771089
<!-- YAML
@@ -2580,6 +2592,7 @@ added: v0.11.3
25802592
[`tls.TLSSocket.getProtocol()`]: #tlssocketgetprotocol
25812593
[`tls.TLSSocket.getSession()`]: #tlssocketgetsession
25822594
[`tls.TLSSocket.getTLSTicket()`]: #tlssocketgettlsticket
2595+
[`tls.TLSSocket.isSessionReused()`]: #tlssocketissessionreused
25832596
[`tls.TLSSocket.servername`]: #tlssocketservername
25842597
[`tls.TLSSocket`]: #class-tlstlssocket
25852598
[`tls.connect()`]: #tlsconnectoptions-callback

0 commit comments

Comments
 (0)