Honor SSL_CERT_FILE/SSL_CERT_DIR and the platform trust store in HTTP clients - #143
Open
chillosu wants to merge 2 commits into
Open
Honor SSL_CERT_FILE/SSL_CERT_DIR and the platform trust store in HTTP clients#143chillosu wants to merge 2 commits into
chillosu wants to merge 2 commits into
Conversation
… clients The reqwest clients (Codex auth/refresh, Codex API, images, transcription, Cursor, Grok) are built with the `rustls-tls` feature, so they trust only the bundled webpki roots. In environments with a private CA or a TLS-inspecting proxy, every request fails with "error sending request for url (...)" even though the system trust store and SSL_CERT_FILE contain the CA. The websocket client already loads the platform store (rustls_native_certs) alongside webpki, so the two paths disagree. Enable reqwest's `rustls-tls-native-roots` feature. reqwest then adds the platform trust store — or, when set, the standard SSL_CERT_FILE / SSL_CERT_DIR locations — in addition to the webpki roots. No new dependencies (rustls-native-certs is already in the tree); behaviour on hosts without a private CA is unchanged. Verified: `claude-code-proxy codex auth device` behind a TLS-inspecting proxy with the inspection CA in SSL_CERT_FILE returned the device sign-in URL where the previous build failed at the first request. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… clients The reqwest clients (Codex auth/refresh, Codex API, images, transcription, Cursor, Grok) are built with the `rustls-tls` feature, so they trust only the bundled webpki roots. In environments with a private CA or a TLS-inspecting proxy, every request fails with "error sending request for url (...)" even though the system trust store and SSL_CERT_FILE contain the CA. The websocket client already loads the platform store (rustls_native_certs) alongside webpki, so the two paths disagree. Enable reqwest's `rustls-tls-native-roots` feature. reqwest then adds the platform trust store — or, when set, the standard SSL_CERT_FILE / SSL_CERT_DIR locations — in addition to the webpki roots. No new dependencies (rustls-native-certs is already in the tree); behaviour on hosts without a private CA is unchanged. Verified: `claude-code-proxy codex auth device` behind a TLS-inspecting proxy with the inspection CA in SSL_CERT_FILE returned the device sign-in URL where the previous build failed at the first request. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HTTP clients only trust the bundled webpki roots, so any host behind a private CA or a TLS-inspecting proxy gets
error sending request for url (...)on every OpenAI request, andSSL_CERT_FILEhas no effect. The websocket client already combines the platform trust store with webpki roots; this makes the HTTP clients do the same.Change
One Cargo feature:
reqwestgainsrustls-tls-native-roots. reqwest then loads the platform trust store, or the standardSSL_CERT_FILE/SSL_CERT_DIRlocations when set, in addition to webpki roots.rustls-native-certsis already a dependency, so the lockfile change is feature-only.Verification
claude-code-proxy codex auth devicebehind a TLS-inspecting proxy →Device init network error: error sending request for url (https://auth.openai.com/api/accounts/deviceauth/usercode); a CONNECT-tunnel capture shows the handshake complete and the client send a TLS alert (untrusted chain).Visit: https://auth.openai.com/codex/devicewith a device code, with the inspection CA provided viaSSL_CERT_FILE.curlwith the same CA file verifies the same endpoint, confirming the chain is valid on the host.Notes
SSL_CERT_FILEorSSL_CERT_DIRto provide a custom CA bundle."