You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
crypto/x509: support SSL_CERT_FILE/DIR on Darwin and Windows #77865
On darwin systems we use the platform certificate verifier, instead of the native Go one, by default. The only time we don't do this is if GODEBUG=x509usefallbackroots=1 is set and x509.SetFallbackRoots has been called.
Using the system verifier relies on a program being able to access the trustd service (via the darwin APIs we call), which is a daemon which does all of the certificate verification work for us.
There are some scenarios where someone running a Go program may want to limit access to trustd (e.g. see anthropics/sandbox-runtime#118). In this scenario, the program cannot be directly mutated to change the verifier settings (e.g. by using x509.SetFallbackRoots) and may wish to choose which roots to trust using SSL_CERT_FILE.
Currently, we explicitly do not support SSL_CERT_FILE on darwin, and only support it on non-darwin unix's.
It may be reasonable to support this use-case, by falling back to the native Go verifier if SSL_CERT_FILE is set on darwin system.
This could cause breakage, as we explicitly document that SSL_CERT_FILE is not used on darwin systems by Go, but is used by other programs in the environment and is set. Adding support for SSL_CERT_FILE would thus result in a change in program behavior, as we would no longer use the platform verifier.
This could be remedied by introducing a new GODEBUG that tells the program to either use the value of SSL_CERT_FILE or ignore it (e.g. maintaining our existing behavior).
We already support SSL_CERT_FILE and SSL_CERT_DIR on all of the Unixes except Darwin.
If we support SSL_CERT_FILE, we should probably support SSL_CERT_DIR, too (unfortunately)
The main drawback of this is that we currently document that we ignore SSL_CERT_FILE on Darwin. We'd add GODEBUG=x509sslcertoverrideplatform. It would default to 1, but could be set to 0 to revert to the current behavior on Darwin. On Linux, the platform verifier itself uses SSL_CERT_FILE, so this variable has no effect either way.
This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— aclements for the proposal review group
Speaking only as a user of Go binaries like gh and glab, not the Go language itself, this'd be a welcome change as it's the only significant problem I've run into while sandboxing my Claude Code instance :) The setting workaround in Claude Code is fine for now, but this'd be great to have fixed properly in Go itself. 🙇
Enable support for SSL_CERT_FILE and SSL_CERT_DIR on Darwin, matching all other Unixes. If either is set, the Go library bypasses the platform verifier.
Add a GODEBUG called x509sslcertoverrideplatform, defaulting to 1. If set to 0 on Darwin, we would ignore SSL_CERT_FILE and SSL_CERT_DIR (reverting to pre-Go 1.27 behavior). On Linux, the platform verifier itself uses SSL_CERT_FILE, so this variable has no effect either way.
Question:
If building with a pre-Go 1.27 language version, should x509sslcertoverrideplatform default to 0 (old/compatible behavior)?
No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— aclements for the proposal review group
The proposal is to support SSL_CERT_FILE and SSL_CERT_DIR on Darwin and Windows, as we do on all non-Darwin Unix platforms already. When set, the platform verifier is not used, and the native Go verifier is used instead with the roots found in the relevant file or directory
For compatibility, we will add a GODEBUG called x509sslcertoverrideplatform to control this behavior. It will default to 1 with language version Go 1.27+ and 0 with previous language versions. If set to 0 on Darwin or Windows, we would ignore SSL_CERT_FILE and SSL_CERT_DIR (reverting to pre-Go 1.27 behavior). On other Unixes, the verifier always uses SSL_CERT_FILE, so this variable has no effect either way.
changed the title [-]proposal: crypto/x509: support SSL_CERT_FILE/DIR on Darwin and Windows[/-][+]crypto/x509: support SSL_CERT_FILE/DIR on Darwin and Windows[/+]on May 13, 2026
Activity
gabyhelp commentedon Feb 28, 2026
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
FiloSottile commentedon Feb 28, 2026
I think this is a subset of #71924.
rsc commentedon Apr 21, 2026
If #71924 wants to contemplate broader things that's fine, but the industry has standardized on SSL_CERT_FILE, and we should support that.
aclements commentedon Apr 22, 2026
Proposal review discussion:
SSL_CERT_FILEandSSL_CERT_DIRon all of the Unixes except Darwin.SSL_CERT_FILE, we should probably supportSSL_CERT_DIR, too (unfortunately)SSL_CERT_FILEon Darwin. We'd addGODEBUG=x509sslcertoverrideplatform. It would default to1, but could be set to0to revert to the current behavior on Darwin. On Linux, the platform verifier itself usesSSL_CERT_FILE, so this variable has no effect either way.aclements commentedon Apr 22, 2026
This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— aclements for the proposal review group
connorshea commentedon Apr 26, 2026
Speaking only as a user of Go binaries like
ghandglab, not the Go language itself, this'd be a welcome change as it's the only significant problem I've run into while sandboxing my Claude Code instance :) The setting workaround in Claude Code is fine for now, but this'd be great to have fixed properly in Go itself. 🙇aclements commentedon Apr 29, 2026
Here's the proposal as I understand it:
Enable support for
SSL_CERT_FILEandSSL_CERT_DIRon Darwin, matching all other Unixes. If either is set, the Go library bypasses the platform verifier.Add a
GODEBUGcalledx509sslcertoverrideplatform, defaulting to 1. If set to 0 on Darwin, we would ignoreSSL_CERT_FILEandSSL_CERT_DIR(reverting to pre-Go 1.27 behavior). On Linux, the platform verifier itself usesSSL_CERT_FILE, so this variable has no effect either way.Question:
If building with a pre-Go 1.27 language version, should
x509sslcertoverrideplatformdefault to 0 (old/compatible behavior)?12 remaining items
gopherbot commentedon May 11, 2026
Change https://go.dev/cl/776940 mentions this issue:
crypto/x509: honor SSL_CERT_{FILE,DIR} on windows/darwinaclements commentedon May 13, 2026
No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— aclements for the proposal review group
The proposal is to support
SSL_CERT_FILEandSSL_CERT_DIRon Darwin and Windows, as we do on all non-Darwin Unix platforms already. When set, the platform verifier is not used, and the native Go verifier is used instead with the roots found in the relevant file or directoryFor compatibility, we will add a
GODEBUGcalledx509sslcertoverrideplatformto control this behavior. It will default to 1 with language version Go 1.27+ and 0 with previous language versions. If set to 0 on Darwin or Windows, we would ignoreSSL_CERT_FILEandSSL_CERT_DIR(reverting to pre-Go 1.27 behavior). On other Unixes, the verifier always usesSSL_CERT_FILE, so this variable has no effect either way.[-]proposal: crypto/x509: support SSL_CERT_FILE/DIR on Darwin and Windows[/-][+]crypto/x509: support SSL_CERT_FILE/DIR on Darwin and Windows[/+]crypto/x509: honor SSL_CERT_{FILE,DIR} on windows/darwin
Phase 1 design: fold in multi-lens review findings + brevity pass
Phase 1 Shape A design: sandbox composition (closes #7) (#24)
fix(claude): drop macOS-only SSL_CERT_FILE pin on Linux (#379)
Default Go apps to System certificate trust (#21200)