Skip to content

fix(desktop): load system CAs from OS trust stores; remove obsolete installer app - #3203

Merged
benjaminshafii merged 4 commits into
devfrom
fix/desktop-system-ca-and-remove-installer
Jul 27, 2026
Merged

fix(desktop): load system CAs from OS trust stores; remove obsolete installer app#3203
benjaminshafii merged 4 commits into
devfrom
fix/desktop-system-ca-and-remove-installer

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

Part 1 — Fix: desktop loads system CAs from the OS trust stores

Root cause of the self-hosted TLS incident: resolveSystemCaEnv had exactly one source — tls.getCACertificates("system") — which returns 0 certificates on macOS (measured on the control machine and reproduced here) and misses intermediates outside the ROOT store on Windows. Behind a corporate CA, Chromium surfaces (sign-in, Den API, models) worked while OpenCode (Bun) failed every TLS connection to the org MCP endpoint with unable to verify the first certificate. The richer additive loader existed in the installer since its TLS fix but was never ported to the desktop app.

Changes (apps/desktop/electron/system-ca.mjs + runtime.mjs):

  • Additive, deduped CA bundle: Node runtime store + Windows LocalMachine/CurrentUser Root+CA stores (PowerShell, hidden window, 10s timeout, 8MB cap) + macOS admin keychains (security find-certificate -a -p on System.keychain + SystemRootCertificates.keychain — admin keychains only, login keychain deliberately excluded). Written to system-ca-bundle.pem, passed to all children (OpenCode/Bun reads NODE_EXTRA_CA_CERTS at spawn).
  • Main-process trust too: best-effort tls.setDefaultCACertificates(defaults ∪ additions) so the embedded OpenWork server's own probes (cloud-mcp-health, the new cloud-endpoint-transport diagnostics from feat(diagnostics): capture MCP registration errors and cloud endpoint transport evidence #3201) trust the corporate CA — Object.assign(process.env, …) after boot never reached the main process (this was the root of the earlier "corporate Windows probe_unreachable" field incident).
  • Operator-set NODE_EXTRA_CA_CERTS keeps its skip-and-win semantics; source counts are logged each launch.

Proof (real run on macOS — the failing platform class)

{
  "platform": "darwin",
  "tlsSystemCount": 1,
  "oldBehavior":  { "sources": "runtime=1 platform-disabled=0" },
  "newBehavior": {
    "sources": "runtime=1 macos-keychains=158",
    "bundleFile": "written", "bundleCertCount": 159,
    "envSet": true,
    "mainProcessDefaults": { "before": 147, "after": 195, "extended": true }
  },
  "operatorOverrideSkips": true
}

On the customer's Electron (Node 22.16) the runtime source is 0, so the old path produced nothing — every macOS user failed; the new path ships the keychain-managed corporate CA to OpenCode and the embedded server.

Part 2 — Remove the obsolete standalone installer

apps/installer (Bun webview installer) is replaced by the release pipeline shipping desktop assets directly. Removed end to end:

  • The app, its packaging scripts, tests, and webview-bun lock entries.
  • Workflows: build-client-installer, release-generic-installer, eval-generic-installer-release, ci-installer-windows-trust; the publish-installers job + release gate in release-macos-aarch64.yml.
  • Eval flows/voiceovers that validated the installer binary (installer-tls-trust, generic-installer-release-contract, org-install-link); trimmed installer frames from org-install-activation, first-connection, standard-dmg-bootstrap-zip, organization-display-branding, desktop-upgrade-preserves-server-url, org-aware-dashboard-downloads, den-download-link-match-allowed-versions.
  • OpenWork-Installer-* plumbing: den-api install links now resolve configured artifacts by the standard versioned desktop asset filename (redirect path was already desktop-asset based); den-web install/activation screens simplified (installer-preview.tsx deleted); landing release-asset filter cleaned.
  • bump-version.mjs, check-outbound-access.mjs, helm README, release skill docs updated. Kept packages/install-config + packages/paths (install links are a Den feature; paths used by server/desktop).
  • Repo-wide sweep for apps/installer|openwork-installer|OpenWork-Installer: zero matches outside changelog history.

Tests run (all verified by the reviewer-side commands below)

  • pnpm --dir apps/desktop test131 pass / 0 fail (incl. new incident-case test: runtime=0 + keychain certs → bundle + setDefaultCACertificates superset; dedupe; parser fixtures; optional-API guards)
  • pnpm --dir apps/desktop run typecheck:electron
  • den-api: bun test test/installer-artifacts.test.ts test/install-link-access.test.ts39 pass / 0 fail
  • landing tests ✅ · den-web typecheck ✅ (executor additionally ran landing/den-web builds ✅)
  • pnpm --filter openwork-server typecheck ✅ · pnpm --filter @openwork/app typecheck
  • node scripts/check-outbound-access.mjs ✅ · node --check on every edited script/flow ✅ · pnpm install lockfile update clean ✅

Validation honesty: macOS CA loading proven live on a real machine (mechanism: keychain → bundle → env + extended defaults); no live Windows cert-store run (this environment is macOS — the daytona-windows-cert sandbox is the follow-up for a GPO-injected CA end-to-end); no fraimz/video. Blue Yonder's macOS users (Venkat, Kerthi, Vamsi) are the real-world validation once this ships in 0.18.7.

resolveSystemCaEnv had one source, tls.getCACertificates("system"), which
returns 0 certificates on macOS and misses intermediates outside the ROOT
store on Windows. Behind a corporate CA the Chromium surfaces worked while
OpenCode (Bun) failed every TLS connection to the org endpoint with
'unable to verify the first certificate'.

- port the additive loader to apps/desktop/electron/system-ca.mjs:
  Windows LocalMachine/CurrentUser Root+CA stores via PowerShell, macOS
  admin keychains via security find-certificate, merged and deduped into
  system-ca-bundle.pem for NODE_EXTRA_CA_CERTS
- extend the Electron main process default CA set with the same additions
  (best-effort tls.setDefaultCACertificates) so the embedded OpenWork
  server's own probes trust the corporate CA; env mutation after boot
  never reached it
- operator-set NODE_EXTRA_CA_CERTS keeps its skip-and-win semantics
The generic installer (apps/installer) is replaced by the release
pipeline shipping desktop assets directly. Remove the app, its build and
release workflows, eval flows, version bumping, outbound-access scan
entry, and the OpenWork-Installer-* asset plumbing in den-api install
links, den-web install screens, and the landing release-asset filter.
Configured install-link artifacts now resolve by the standard versioned
desktop asset filename. packages/install-config and packages/paths stay
(install links are a Den feature).
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview, Comment Jul 27, 2026 8:33pm
openwork-den Ready Ready Preview, Comment Jul 27, 2026 8:33pm
openwork-den-worker-proxy Ready Ready Preview, Comment Jul 27, 2026 8:33pm
openwork-diagnostics Ready Ready Preview, Comment Jul 27, 2026 8:33pm
openwork-landing Ready Ready Preview, Comment, Open in v0 Jul 27, 2026 8:33pm

@mintlify

mintlify Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
differentai 🟢 Ready View Preview Jul 27, 2026, 8:14 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying openwork with  Cloudflare Pages  Cloudflare Pages

Latest commit: 84da5c9
Status:⚡️  Build in progress...

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant