Skip to content

Commit 1c9abbd

Browse files
FiloSottilegopherbot
authored andcommitted
crypto/tls: document resumption behavior across Configs
Updates #77113 Updates #77217 Updates CVE-2025-68121 Change-Id: Ia47904a9ed001275aad0243a6a0ce57e6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/740240 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Auto-Submit: Filippo Valsorda <[email protected]>
1 parent cce3fea commit 1c9abbd

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

src/crypto/tls/common.go

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -632,10 +632,13 @@ type Config struct {
632632
// If GetConfigForClient is nil, the Config passed to Server() will be
633633
// used for all connections.
634634
//
635-
// If SessionTicketKey was explicitly set on the returned Config, or if
636-
// SetSessionTicketKeys was called on the returned Config, those keys will
635+
// If SessionTicketKey is explicitly set on the returned Config, or if
636+
// SetSessionTicketKeys is called on the returned Config, those keys will
637637
// be used. Otherwise, the original Config keys will be used (and possibly
638-
// rotated if they are automatically managed).
638+
// rotated if they are automatically managed). WARNING: this allows session
639+
// resumtion of connections originally established with the parent (or a
640+
// sibling) Config, which may bypass the [Config.VerifyPeerCertificate]
641+
// value of the returned Config.
639642
GetConfigForClient func(*ClientHelloInfo) (*Config, error)
640643

641644
// VerifyPeerCertificate, if not nil, is called after normal
@@ -653,8 +656,10 @@ type Config struct {
653656
// rawCerts may be empty on the server if ClientAuth is RequestClientCert or
654657
// VerifyClientCertIfGiven.
655658
//
656-
// This callback is not invoked on resumed connections, as certificates are
657-
// not re-verified on resumption.
659+
// This callback is not invoked on resumed connections. WARNING: this
660+
// includes connections resumed across Configs returned by [Config.Clone] or
661+
// [Config.GetConfigForClient] and their parents. If that is not intended,
662+
// use [Config.VerifyConnection] instead, or set [Config.SessionTicketsDisabled].
658663
//
659664
// verifiedChains and its contents should not be modified.
660665
VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
@@ -978,8 +983,15 @@ func (c *Config) ticketKeyFromBytes(b [32]byte) (key ticketKey) {
978983
// ticket, and the lifetime we set for all tickets we send.
979984
const maxSessionTicketLifetime = 7 * 24 * time.Hour
980985

981-
// Clone returns a shallow clone of c or nil if c is nil. It is safe to clone a [Config] that is
982-
// being used concurrently by a TLS client or server.
986+
// Clone returns a shallow clone of c or nil if c is nil. It is safe to clone a
987+
// [Config] that is being used concurrently by a TLS client or server.
988+
//
989+
// The returned Config can share session ticket keys with the original Config,
990+
// which means connections could be resumed across the two Configs. WARNING:
991+
// [Config.VerifyPeerCertificate] does not get called on resumed connections,
992+
// including connections that were originally established on the parent Config.
993+
// If that is not intended, use [Config.VerifyConnection] instead, or set
994+
// [Config.SessionTicketsDisabled].
983995
func (c *Config) Clone() *Config {
984996
if c == nil {
985997
return nil

0 commit comments

Comments
 (0)