The App Sandbox
Jun 24, 2020

Summary
This post details the technical implementation of Electron app sandboxing in Slack. It explains the security risks of XSS and RCE in Electron apps, the analogy of political checks and balances for sandboxing, and the tradeoffs involved (renderer processes cannot use Node). It covers dependency untangling using `dependency-cruiser` to visualize and restrict import chains between main, renderer, and preload bundles, and the use of `contextBridge` to safely expose desktop functionality from preload scripts to guest pages, enabling communication with the main process via IPC and Promises.