SIGN IN SIGN UP
caddyserver / caddy UNCLAIMED

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

0 0 102 Go

caddytls: fix TLS state races and ECH rotation retry (#7756)

* caddytls: fix data race in session ticket key rotation

stayUpdated copies the map header (configs := s.configs) under the
lock, then iterates the original map after releasing it. Concurrent
calls to register/unregister mutate the same map.

Hold the lock for the entire iteration instead.

* caddytls: fix data race in AllMatchingCertificates

AllMatchingCertificates reads the package-level certCache without
acquiring certCacheMu, while Cleanup sets certCache to nil under
the write lock. The adjacent HasCertificateForSubject correctly
acquires certCacheMu.RLock.

Add the missing RLock/RUnlock to match.

* caddytls: fix ECH key rotation stopping permanently on error

When rotateECHKeys returns an error, the rotation goroutine returns
immediately, stopping all future key rotation for the lifetime of
the process.

Change return to continue, matching the error handling for
publishECHConfigs two lines below.
C
cbro committed
325c244ea71a645c224afa1d0b46296ed76ef9fd
Parent: 0125ae3
Committed by GitHub <noreply@github.com> on 5/20/2026, 6:35:40 AM