fix(desktop): trust system certificates (#25837)

This commit is contained in:
Luke Parker 2026-05-05 18:47:38 +10:00 committed by GitHub
commit b8f8f5d3a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 189 additions and 8 deletions

View file

@ -4,6 +4,7 @@ import { existsSync } from "node:fs"
import { createServer } from "node:net"
import { homedir } from "node:os"
import { join } from "node:path"
import { getCACertificates, setDefaultCACertificates } from "node:tls"
import type { Event } from "electron"
import { app, BrowserWindow, dialog } from "electron"
import pkg from "electron-updater"
@ -65,6 +66,8 @@ const pendingDeepLinks: string[] = []
const serverReady = defer<ServerReadyData>()
const logger = initLogging()
useSystemCertificates()
logger.log("app starting", {
version: app.getVersion(),
packaged: app.isPackaged,
@ -122,6 +125,14 @@ function setupApp() {
})
}
function useSystemCertificates() {
try {
setDefaultCACertificates([...new Set([...getCACertificates("default"), ...getCACertificates("system")])])
} catch (error) {
logger.warn("failed to load system certificates", error)
}
}
function emitDeepLinks(urls: string[]) {
if (urls.length === 0) return
pendingDeepLinks.push(...urls)