use stdlib's x509.SystemCertPool on Windows#6929
Merged
thaJeztah merged 2 commits intodocker:masterfrom Apr 15, 2026
Merged
Conversation
The `tlsconfig.SystemCertPool` utility in go-connections was added in [docker/go-connections@55aadc3], at which time Go stdlib didn't support system-pools ([x509.SystemCertPool]) on Windows, so an empty pool was constructed. Support for system pools on Windows originally added in Go 1.8 (through [golang/go@05471e9]), but reverted, and re-implemented in Go 1.18 (through [golang/go@3544082]). Go 1.18 and up now implement this, but, unlike Linux, which uses a pure-Go implementation, certificate validation is handled by the system: > On macOS and Windows, certificate verification is handled by system APIs, > but the package aims to apply consistent validation rules across operating > systems. On macOS and Windows, x509.SystemCertPool returns an empty Pool, with the `systemPool` set to `true` (see [loadSystemRoots]). This must be considered an implementation detail; custom CAs can be appended to this pool, and handled as usual. This patch removes the special handling on Windows, removing the dependency on go-connections for this part. [docker/go-connections@55aadc3]: docker/go-connections@55aadc3 [golang/go@05471e9]: golang/go@05471e9 [golang/go@3544082]: golang/go@3544082 [x509.SystemCertPool]: https://pkg.go.dev/crypto/x509#SystemCertPool [loadSystemRoots]: https://cs.opensource.google/go/go/+/refs/tags/go1.26.1:src/crypto/x509/root_windows.go;l=15-17 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The `tlsconfig.SystemCertPool` utility in go-connections was added in [docker/go-connections@55aadc3], at which time Go stdlib didn't support system-pools ([x509.SystemCertPool]) on Windows, so an empty pool was constructed. Support for system pools on Windows originally added in Go 1.8 (through [golang/go@05471e9]), but reverted, and re-implemented in Go 1.18 (through [golang/go@3544082]). Go 1.18 and up now implement this, but, unlike Linux, which uses a pure-Go implementation, certificate validation is handled by the system: > On macOS and Windows, certificate verification is handled by system APIs, > but the package aims to apply consistent validation rules across operating > systems. On macOS and Windows, x509.SystemCertPool returns an empty Pool, with the `systemPool` set to `true` (see [loadSystemRoots]). This must be considered an implementation detail; custom CAs can be appended to this pool, and handled as usual. This patch removes the special handling on Windows, removing the dependency on go-connections for this part. [docker/go-connections@55aadc3]: docker/go-connections@55aadc3 [golang/go@05471e9]: golang/go@05471e9 [golang/go@3544082]: golang/go@3544082 [x509.SystemCertPool]: https://pkg.go.dev/crypto/x509#SystemCertPool [loadSystemRoots]: https://cs.opensource.google/go/go/+/refs/tags/go1.26.1:src/crypto/x509/root_windows.go;l=15-17 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
vvoland
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
relates to:
use stdlib's x509.SystemCertPool on Windows
The
tlsconfig.SystemCertPoolutility in go-connections was added indocker/go-connections@55aadc3, at which time Go stdlib didn't support
system-pools (x509.SystemCertPool) on Windows, so an empty pool was
constructed.
Support for system pools on Windows originally added in Go 1.8 (through
golang/go@05471e9), but reverted, and re-implemented in Go 1.18 (through
golang/go@3544082).
Go 1.18 and up now implement this, but, unlike Linux, which uses a pure-Go
implementation, certificate validation is handled by the system:
On macOS and Windows, x509.SystemCertPool returns an empty Pool, with the
systemPoolset totrue(see loadSystemRoots). This must be consideredan implementation detail; custom CAs can be appended to this pool, and handled
as usual.
This patch removes the special handling on Windows, removing the dependency
on go-connections for this part.
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)