Skip to content

use stdlib's x509.SystemCertPool on Windows#6929

Merged
thaJeztah merged 2 commits intodocker:masterfrom
thaJeztah:stdlib_systempools
Apr 15, 2026
Merged

use stdlib's x509.SystemCertPool on Windows#6929
thaJeztah merged 2 commits intodocker:masterfrom
thaJeztah:stdlib_systempools

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

relates to:

use stdlib's x509.SystemCertPool on Windows

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.

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

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>
@thaJeztah thaJeztah added this to the 29.4.1 milestone Apr 15, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/registry/registry.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@thaJeztah thaJeztah merged commit 84b357f into docker:master Apr 15, 2026
116 of 117 checks passed
@thaJeztah thaJeztah deleted the stdlib_systempools branch April 15, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants