Skip to content

fix: trust the system certificate store in the desktop backend - #2001

Open
ZacharyZcR wants to merge 1 commit into
Termix-SSH:dev-26.11.4from
ZacharyZcR:fix/desktop-system-ca
Open

ZacharyZcR wants to merge 1 commit into
Termix-SSH:dev-26.11.4from
ZacharyZcR:fix/desktop-system-ca

Conversation

@ZacharyZcR

Copy link
Copy Markdown
Member

Fixes #1987.

Cause

The packaged app runs with the `nodeOptions` fuse off. In that case Electron itself unsets `NODE_EXTRA_CA_CERTS` while Node starts in the main process (`shell/common/node_bindings.cc` in v45.3.2), before `main.cjs` runs. `...process.env` in `utilityProcess.fork` therefore never passes the variable on. The code from #1895 in `starter.ts` never runs in the desktop app, and plugin processes (Sync) get no extra certificates.

The main process already merges `tls.getCACertificates("system")`, but the embedded backend and the plugin processes it starts did not.

Change

  • `extraCaCertificates` also returns the system store when `ELECTRON_EMBEDDED=true`. These are the same certificates the app window and the main process already trust. The bridge already hands this list to every plugin process.
  • `starter.ts` always applies the list. It still warns when `NODE_EXTRA_CA_CERTS` is set but nothing could be added.
  • Servers (not desktop) behave as before: only the file.

A user with a private CA adds it to the OS trust store (Keychain, certmgr, or the distro store). The reporter already did this.

Tests

  • `extra-ca.test.ts`: desktop adds the system store, alone and together with the file; server does not.
  • `tsc -p tsconfig.node.json` and eslint are clean.

Electron drops NODE_EXTRA_CA_CERTS while the nodeOptions fuse is off, so the
embedded backend never saw the variable and plugin processes such as Sync
could not reach a server signed by a private CA. Trust the system store
there too, like the app window and the main process already do.
@termix-triage-bot

Copy link
Copy Markdown

AI review | Looks safe to merge

Adds system CA certificates to the trusted store for the desktop backend when Electron fuses drop NODE_EXTRA_CA_CERTS. The change is safe, well tested, and follows repo standards.

Reviewed 4f8b343. AI can be wrong, a maintainer still decides. Comment /termix review to run it again.

This branch has not been deployed

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

Labels

None yet

Projects

Status: Open PRs

Development

Successfully merging this pull request may close these issues.

1 participant