Files
node/lib
Tony Gies 705646f2f7 tls: read the peer certificate chain without consuming it
X509Certificate::GetPeerCert() built the certificate objects by deleting
entries from the stack returned by SSL_get_peer_cert_chain(), which is
owned by the SSL session. The first read emptied it, so any later read
by getPeerCertificate() or getPeerX509Certificate(), on either peer, saw
a truncated chain or nothing. Copy each issuer with X509_dup instead and
leave the session's stack untouched.

onServerSocketSecure() only called getPeerX509Certificate() to check
whether a peer certificate was present, building the whole chain on
every server handshake; that is what first exposed the destructive read.
Use a lightweight hasPeerCertificate() binding for the presence check.

Signed-off-by: Tony Gies <tgies@tgies.net>
PR-URL: https://github.com/nodejs/node/pull/65602
Fixes: https://github.com/nodejs/node/issues/65579
Refs: https://github.com/nodejs/node/pull/64677
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-08-31 18:04:06 +00:00
..
…
…
…
2026-07-05 08:04:44 +00:00
…
…
…
2026-08-06 09:25:51 +00:00
2026-08-29 00:58:18 +02:00
2026-06-21 19:42:03 +00:00
2026-05-31 12:49:51 -07:00
2026-08-13 15:25:11 +00:00
…
…
…
…
2026-07-25 23:56:46 -07:00
…
…
…
…
…
2026-08-23 15:52:12 +00:00
…
…
…