fix(desktop): use system CAs for bundled server requests #23424
Problem#
The desktop's bundled Electron 44.9.3 / Node 24.22.0 runtime rejects public TLS chains with UNABLE_TO_VERIFY_LEAF_SIGNATURE, preventing relay requests when enabling T3 Connect on the reported macOS nightly. A version-matched Linux probe reproduces the certificate failure against api.github.com; the relay itself succeeds on Linux.
Change#
Start the primary desktop backend with --use-system-ca before its preload and entry script. This adds the operating system's trusted CAs to the bundled store through a process argument, without adding a CA environment override inherited by provider CLIs or terminals.
Scope and approval#
Fixes https://git.cafe/pingdotgg/t3code/issues/23408
Triaged bug via the automated issue flow. The change is confined to the native primary desktop backend's startup configuration and its regression coverage.
Verification#
- Red at aff87ef38b: the new startup-contract test fails because
--use-system-cais absent; 17 tests pass and 1 fails. - Green at 5db44425a7:
vp test run apps/desktop/src/backend/DesktopBackendConfiguration.test.tspasses all 18 tests. Targeted lint on both changed files and the desktop typecheck pass. - Linux x64, downloaded Electron 44.9.3 / Node 24.22.0: with
ELECTRON_RUN_AS_NODE=1and CA environment overrides unset, api.github.com changes from certificate verification failure to HTTP 403 with the flag. HTTP 403 establishes TLS completion, not API authorization. relay.t3.codes returns HTTP 302 in both runs. - A real server started with that Electron runtime and the flag reaches its ready event against isolated state. An untrusted self-signed certificate is still rejected.
cannot-verify desktop: packaged macOS/Windows startup and the original macOS Settings → T3 Connect flow were not verified on this Linux VM. The Linux transcript verifies the mechanism, not macOS relay recovery.
Evidence matrix: no render paths changed (0 affected visual fixtures); runtime and test output provide the before/after proof. WSL, standalone servers, web/mobile renderers, contracts, and provider adapters are outside this change.
Evidence matrix / proof audit pass 1 · Proof audit pass 2 · Sanitized red/green, runtime and server transcript · Reproduction script
Implementation and red test: Claude Opus 5.5 through the Claude Agent SDK harness. Triage, proof, and independent review: GPT-6.1 Sol through the Codex harness and Claude Opus 5.5 through the Claude Agent SDK harness.
Fixes pingdotgg/t3code#23408
- 1
- 2
Pusheda11f7e5
Sign in to join this conversation.
Additional packaged macOS evidence for another common setup: a self-hosted Forgejo server using a local private CA (
mkcert) trusted in the macOS System Keychain.Setup: macOS arm64, packaged T3 Code desktop app (bundled Node
v24.22.1),fjCLI authenticated against an internal HTTPS Forgejo instance whose root CA is installed and trusted in macOS Keychain.Observed behavior:
fj whoamisucceeds (Rust CLI uses the macOS trust store), so Forgejo auth discovery enters thefjpath.ForgejoCli.requestFjviaFetchHttpClient) then fails every API call (account check, PR status polling, issue lookup) withUNABLE_TO_VERIFY_LEAF_SIGNATURE(unable to verify the first certificate), because the bundled Node child does not load macOS system CAs by default.ELECTRON_RUN_AS_NODE=1):tls.getCACertificates("system")includes the locally trusted private root CA (default: 127, system: 8, bundled: 118).NODE_EXTRA_CA_CERTS),fetchto the Forgejo API fails withUNABLE_TO_VERIFY_LEAF_SIGNATURE.--use-system-ca(this PR's change), the same request succeeds (HTTP 200) without needing a manualNODE_EXTRA_CA_CERTSworkaround.NODE_OPTIONS=--use-system-cadoes not work because Electron printsNode.js environment variables are disabled because this process is invoked by other apps.Would love to see this land — it removes the need for
NODE_EXTRA_CA_CERTSfor anyone running self-hosted Git/Forgejo or internal services behind an OS-trusted private CA on macOS.