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).
cc @golang/security @rsc
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.SetFallbackRootshas 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).
cc @golang/security @rsc