Skip to content

Zig only reads CA Certificates from SystemRootCertificates.keychain and not from System.keychain #22700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dreilly1982 opened this issue Jan 31, 2025 · 3 comments · Fixed by #22701
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@dreilly1982
Copy link
Contributor

Zig Version

0.14.0-dev.2989+bf6ee7cb3

Steps to Reproduce and Observed Behavior

run zig fetch <url> returns error: unable to connect to server: TlsInitializationFailed this is due to a TLS intercept using a coporate signed TLS certificate.

Expected Behavior

I am very sure that this was intended as written, however many organizations use TLS intercept on their devices. Allowing to read certificates from both /System/Library/Keychains/SystemRootCertificates.keychain as well as /Library/Keychains/System.keychain would allow trusted intercept certificates to be installed in the System keychain, and still be trusted for actions such as "zig build fetch".

@dreilly1982 dreilly1982 added the bug Observed behavior contradicts documented or intended behavior label Jan 31, 2025
@dreilly1982
Copy link
Contributor Author

I only mentioned zig fetch in the initial issue as this is where I found the issue, and the fetch command doesn't currently have any apparent way to pass the arguments to ignore TLS verification. This is a show stopper for anyone using Zig on machines where their traffic is forced through intercept proxies on MacOS.

@Ugenx
Copy link

Ugenx commented Feb 3, 2025

Just ran into this issue myself. Found #15681 which seems like the correct way to address this situation.

@dreilly1982
Copy link
Contributor Author

Thank you for referencing that, it had not come up in my search through issues. The approach I went with in my PR was to also look in System.keychain for valid trusted certs. My thought is if it is in System.keychain then at least an administrator on the system installed it. This could be easily expanded to user keychains, and I feel that would be the appropriate way to add trusted certificates on MacOS. As for an ignore TLS flag, it looks simple enough to implement, but that wasn't my intent in this particular issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants