mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-09 01:46:46 +08:00
All renderer windows ran with `sandbox: false`, so the preload script — which holds the full IPC surface exposed via contextBridge — executed in an unsandboxed context. The preload only uses sandbox-safe APIs (the `electron` module and the polyfilled `process`), so the sandbox can be turned on without touching it. The one real dependency was the build: `@electron-toolkit/preload` was externalized, and a sandboxed preload's `require` can only load `electron` plus a couple of node builtins. electron.vite.config.ts now bundles it into the single CJS preload output, which is exactly what the sandbox requires. `createRendererWebPreferences` moved out of index.ts into its own module so the security-relevant flags are pinned by a unit test; index.ts cannot be imported in tests because it registers app lifecycle handlers on import. Comments in index.ts and navigation-guard.ts that described the old `sandbox: false` state are updated. `webSecurity: false` stays off for now — restoring it requires migrating the renderer onto a privileged custom protocol so CORS preflights carry a real Origin, which needs server-side coordination first.