feat: trust internal CAs when pushing to Kibana#1150
Draft
shahzad31 wants to merge 1 commit into
Draft
Conversation
The push/locations CLI talks to Kibana via undici. When Kibana sits behind an internal/private CA the request fails with "unable to get local issuer certificate", and neither NODE_TLS_REJECT_UNAUTHORIZED nor strict-ssl helped. Honor the `certificateAuthorities` option for the CLI by appending the provided CAs to Node's built-in roots and passing the bundle to the undici dispatcher (EnvHttpProxyAgent connect / ProxyAgent requestTls). Public roots are preserved so trust for publicly signed endpoints is never dropped, and `NODE_EXTRA_CA_CERTS` keeps working as before. Relates to #746. Co-authored-by: Cursor <cursoragent@cursor.com>
2f9facd to
c1a01c2
Compare
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
The
push/locationsCLI talks to Kibana over undici. When Kibana is fronted by an internal/private CA, these commands fail withunable to get local issuer certificate, and the usual escapes (NODE_TLS_REJECT_UNAUTHORIZED=0,npm config strict-ssl false) don't help (see #746).This PR makes the CLI honor the same
certificateAuthoritiesoption introduced in #1149:setGlobalProxynow builds a CA bundle of Node's built-in roots + the user provided CAs and passes it to the undici dispatcher (EnvHttpProxyAgent'sconnect.ca, orProxyAgent'srequestTls.cawhen a proxy is configured).NODE_EXTRA_CA_CERTScontinues to work out of the box (undici honors it); this option just additionally supports config/flag-provided CAs.Closes #746
Usage
Same
certificateAuthoritiesoption as #1149 — it now also covers the CLI -> Kibana connection. Use it onpush(andlocations):Config (
synthetics.config.ts):CLI:
Try it locally
Reproduce the failure and the fix without a real Kibana:
(The automated integration test below does exactly this against a fixture CA.)
Test plan
buildCABundleunit test: returnsundefinedwith no CA, and roots + extra otherwise (__tests__/core/certs.test.ts)setGlobalProxy(__tests__/core/proxy-ca.test.ts)locationsproxy tests still passtsc,eslint,prettier --check, full unit suite greenMade with Cursor