[BUG] macOS sandbox blocks Security.framework TLS verification, breaking Go binaries (gh, terraform, etc.)
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
- Enable sandbox in managed-settings.json with "enabled": true
- Add api.github.com to allowedDomains
- 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.
8 Comments
Seems like there's a fix on the way here: https://github.com/anthropic-experimental/sandbox-runtime/pull/120
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.
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.
Any updates on this issue? 🙏
Any updates on this?
Looking forward to seeing something like a new
sandbox.enableWeakerNetworkIsolationoption for macOS based on the fix https://github.com/anthropic-experimental/sandbox-runtime/pull/120 added in the sandbox configurations of Claude Code.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?
This is implemented in
2.1.69and that feature when enabled fixed my issue.