fix(tls): apply custom CA certificates to all fetch call sites (CLI-1KW)#966
Merged
Conversation
The CLI-1K6 fix added custom CA support but only wired it into 2 of 13 fetch call sites. Users behind corporate TLS proxies still hit certificate errors on upgrade, shared issue resolution, init wizard, and telemetry. Add customFetch() wrapper in custom-ca.ts and apply it to all remaining bare fetch() calls. For the telemetry transport (uses http.request()), pass caCerts through Sentry.init() transportOptions. Also adds log.debug() to previously-silent catch blocks in delta-upgrade, release-notes, and readiness modules.
Contributor
|
Contributor
Codecov Results 📊✅ 6969 passed | Total: 6969 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 69.35%. Project has 14094 uncovered lines. Files with missing lines (5)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 77.12% 77.11% -0.01%
==========================================
Files 320 320 —
Lines 61522 61570 +48
Branches 0 0 —
==========================================
+ Hits 47447 47476 +29
- Misses 14075 14094 +19
- Partials 0 0 —Generated by Codecov Action |
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
customFetch()wrapper incustom-ca.tsthat auto-injects TLS options, and apply it to all 11 previously-uncoveredfetch()call sitescaCertsthroughSentry.init({ transportOptions })for the telemetry transport (useshttp.request(), notfetch())log.debug()to previously-silent catch blocks in delta-upgrade, release-notes, and readiness modulesProblem
CLI-1K6 added custom CA certificate support for corporate TLS-intercepting proxies but only wired it into 2 of 13 fetch call sites (
sentry-client.tsandoauth.ts). Users behind proxies still hitApiError: TLS certificate erroron:issues.ts:getSharedIssue)binary.ts,ghcr.ts,delta-upgrade.ts)release-notes.ts)wizard-runner.ts,readiness.ts)telemetry.ts→zstd-transport.ts)Approach
Rather than sprinkling
...getCustomTlsOptions()at each site, a thincustomFetch()wrapper centralizes the TLS injection — easy to audit, impossible to forget for future call sites.For the telemetry transport (which uses Node's
http.request(), notfetch()), the existingoptions.caCertsplumbing was already in place inzstd-transport.tsbutSentry.init()never provided the value. AddedgetCustomCaCerts()accessor and wired it throughtransportOptions.Files changed (10)
src/lib/custom-ca.tscustomFetch(),getCustomCaCerts()src/lib/api/issues.tscustomFetch+ SaaS warning + TLS error handlingsrc/lib/binary.tscustomFetch+ TLS error branchsrc/lib/ghcr.tscustomFetchat 3 call sitessrc/lib/delta-upgrade.tscustomFetch+log.debugin catchessrc/lib/release-notes.tscustomFetch+log.debugin catchsrc/lib/init/wizard-runner.tscustomFetchin Mastra wrappersrc/lib/init/readiness.tscustomFetch+log.debugin catchsrc/lib/telemetry.tscaCertstoSentry.init()test/lib/custom-ca.test.tscustomFetchandgetCustomCaCertsFixes CLI-1KW