Skip to content

Commit 49f8725

Browse files
fix(ssl): Pass CA bundle env vars to curl on macOS (#3301)
On macOS, sentry-cli links system libcurl which uses SecureTransport as its TLS backend. SecureTransport ignores SSL_CERT_FILE, so custom CA bundles (e.g. corporate MITM proxies) don't work even though openssl_probe sets the env var. This reads SSL_CERT_FILE (or CURL_CA_BUNDLE) back and passes it via CURLOPT_CAINFO, which SecureTransport does honor. Previously we would get a TLS validation when running through our https proxy, like this ``` error: API request failed Caused by: 0: API request failed 1: [60] SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate) ``` Let me know if I should approach this differently or open an issue first to discuss this --------- Co-authored-by: Daniel Szoke <daniel.szoke@sentry.io>
1 parent 1d51919 commit 49f8725

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Respect `CURL_CA_BUNDLE` and `SSL_CERT_FILE` when configuring TLS certificate authorities ([#3301](https://github.com/getsentry/sentry-cli/pull/3301)).
8+
39
## 3.4.3
410

511
### Security Fixes

src/api/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ impl Api {
244244
handle.ssl_verify_host(self.config.should_verify_ssl())?;
245245
handle.ssl_verify_peer(self.config.should_verify_ssl())?;
246246

247+
if let Ok(ca_bundle) = std::env::var("CURL_CA_BUNDLE") {
248+
handle.cainfo(&ca_bundle)?;
249+
} else if let Ok(ca_bundle) = std::env::var("SSL_CERT_FILE") {
250+
handle.cainfo(&ca_bundle)?;
251+
}
252+
247253
let env = self.config.get_pipeline_env();
248254
let headers = self.config.get_headers();
249255

0 commit comments

Comments
 (0)