Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): use system CAs for bundled server requests #23424

Openjuliusmarmingewants to merge 3 commits intomain fromrefs/pull/23424/headopened View on GitHub

juliusmarmingecommented

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-ca is absent; 17 tests pass and 1 fails.
  • Green at 5db44425a7: vp test run apps/desktop/src/backend/DesktopBackendConfiguration.test.ts passes 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=1 and 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. Pusheda11f7e5

    2. 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), fj CLI authenticated against an internal HTTPS Forgejo instance whose root CA is installed and trusted in macOS Keychain.

      Observed behavior:

      • fj whoami succeeds (Rust CLI uses the macOS trust store), so Forgejo auth discovery enters the fj path.
      • T3 Code's bundled Node server (ForgejoCli.requestFj via FetchHttpClient) then fails every API call (account check, PR status polling, issue lookup) with UNABLE_TO_VERIFY_LEAF_SIGNATURE (unable to verify the first certificate), because the bundled Node child does not load macOS system CAs by default.
      • Checking the packaged runtime directly (ELECTRON_RUN_AS_NODE=1):
        • tls.getCACertificates("system") includes the locally trusted private root CA (default: 127, system: 8, bundled: 118).
        • With default launch flags (no NODE_EXTRA_CA_CERTS), fetch to the Forgejo API fails with UNABLE_TO_VERIFY_LEAF_SIGNATURE.
        • With --use-system-ca (this PR's change), the same request succeeds (HTTP 200) without needing a manual NODE_EXTRA_CA_CERTS workaround.
        • Setting NODE_OPTIONS=--use-system-ca does not work because Electron prints Node.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_CERTS for anyone running self-hosted Git/Forgejo or internal services behind an OS-trusted private CA on macOS.

Sign in to join this conversation.