Skip to content

macOS: honor SSL_CERT_FILE so gh can verify TLS against a custom CA bundle (enterprise CA / sandboxes without trustd) #13676

Closed as duplicate

Description

@davidlovas

Describe the bug

On macOS, Go's crypto/x509 defers certificate verification to Security.framework (the trustd mach service) whenever tls.Config.RootCAs is nil, and — unlike Linux — Go on macOS does not honor SSL_CERT_FILE/SSL_CERT_DIR. That leaves no way to point gh at an explicit CA bundle, which breaks two real scenarios with the same root cause:

  1. Internal/enterprise CA not in the system store — GHE behind a private CA fails with certificate signed by unknown authority. (This is Skip certificate warning, using internal enterprise CA "certificate signed by unknown authority" #1735.)
  2. trustd unreachable — in sandboxed environments (some agent/CI sandboxes) the mach service is blocked, so every gh HTTPS call (REST, GraphQL, auth) fails with x509 verification errors, with no escape hatch.

Expected behavior

A documented env var (SSL_CERT_FILE, matching the Linux/OpenSSL convention) lets gh verify TLS against an explicit PEM CA bundle without relying on trustd or the system store.

Proposed fix

At startup, if SSL_CERT_FILE (or a GH_-prefixed variant) is set, load the PEM into an x509.CertPool and set it as RootCAs on a clone of http.DefaultTransport. A non-nil RootCAs forces Go's pure-Go verifier, bypassing trustd. No-op when unset; everything built via go-gh's api.NewHTTPClient inherits http.DefaultTransport, so all clients pick it up.

Reference implementation

We implemented this in a fork as a single init() honoring GH_SSL_CERT_FILE/SSL_CERT_FILE: rexovasgroup#51. Happy to open a PR upstream if there's interest.

Resolving this would also address #1735.

Activity

  1. babakks commented on Jun 19, 2026

    @babakks
    Member

    Thanks for your feedback and example implementation, @davidlovas! 🙏

    As you already pointed out, this has been tracked in #1735. So, I'm going to close this as a duplicate of that. Please feel free to share your thoughts/experience on that thread (especially the trustd access issue which is a rather new aspect to this), so that we can have them in one place.

  2. removed
    needs-triage
    on Jun 19, 2026
  3. added
    auth
    on Jun 19, 2026
  4. justinmchase commented on Sep 29, 2026

    @justinmchase

    This is a pretty major issue. It completely blocks me inside our corporate vnet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    auth

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions