[BUG] macOS sandbox blocks Security.framework TLS verification, breaking Go binaries (gh, terraform, etc.)

Status Open
Reported on v2.1.31
Maintainer reply None cached
Activity 8 comments · opened Feb 5, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bug Description

When sandbox mode is enabled via managed-settings.json, any Go-based CLI tool (gh, terraform, kubectl, aws-cli, etc.) fails with:
tls: failed to verify certificate: x509: OSStatus -26276

Root Cause

Go on macOS uses cgo to call Security.framework for TLS certificate verification. The sandbox blocks these syscalls. Python (which uses OpenSSL) works fine in the same sandbox.

Evidence

  • gh api user inside sandbox → x509 error
  • python3 urllib.request.urlopen('https://api.github.com') inside sandbox → works
  • gh api user outside sandbox → works
  • Disabling sandbox → gh works
  • Setting SSL_CERT_FILE, GIT_SSL_CAINFO, copying certs locally → still fails
  • Using GH_TOKEN env var (bypassing keyring) → still fails
  • Zscaler disabled → still fails
  • Removing network settings from managed-settings.json → still fails

What Should Happen?

Go binaries should be able to verify TLS certificates when making HTTPS requests to allowed domains.

Error Messages/Logs

Error: Exit code 1
     Get "https://api.github.com/user": tls: failed to verify certificate: x509: OSStatus -26276

Steps to Reproduce

Reproduction Steps

  1. Enable sandbox in managed-settings.json with "enabled": true
  2. Add api.github.com to allowedDomains
  3. Run gh api user inside Claude Code

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.31 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Suggested Fix

Either allowlist Security.framework syscalls for TLS verification in the sandbox profile, or automatically set SSL_CERT_FILE to a bundled/accessible cert store for sandboxed processes.

View original on GitHub ↗

8 Comments

stekern · 6 months ago
ehsan · 6 months ago

FWIW I asked Claude to write this script that patches the locally installed Claude Code to work around this bug: https://gist.github.com/ehsan/8c1bc6570c1c924f6ac4f8e1e58158ba

You would need to rerun this script every time Claude Code updates to re-apply the patch but it might help someone in the meantime.

jamestelfer · 6 months ago

I'm looking forward for the fix to merge. I do find it odd that (considering the blast radius) that the fix would be disabled by default.

ehsan · 6 months ago

Any updates on this issue? 🙏

dlhck · 6 months ago

Any updates on this?

mmizutani · 6 months ago

Looking forward to seeing something like a new sandbox.enableWeakerNetworkIsolation option for macOS based on the fix https://github.com/anthropic-experimental/sandbox-runtime/pull/120 added in the sandbox configurations of Claude Code.

compojoom · 6 months ago
➜ strings ~/.local/share/claude/versions/2.1.63 2>/dev/null | grep -oE '"0\.0\.[0-9]+"' | sort -u "0.0.0" "0.0.1" "0.0.36" "0.0.37"

Not sure if I'm right or not, but it seems that the latest claude version is bundled with anthropic-sandbox 0.0.37(which is supposed to have this). Unfortunately passing
"sandbox" : {
....
"enableWeakerNetworkIsolation": true,
}

doesn't seem to be forwarded properly to the sandbox? I don't have explanation?

gustafj · 5 months ago
Looking forward to seeing something like a new sandbox.enableWeakerNetworkIsolation option for macOS based on the fix anthropic-experimental/sandbox-runtime#120 added in the sandbox configurations of Claude Code.

This is implemented in 2.1.69 and that feature when enabled fixed my issue.