Skip to main content
Desktop electron critical

Electron IPC Patterns

Secure Electron IPC patterns using contextBridge, preload scripts, and type-safe communication between main and renderer processes.

Difficulty
intermediate
Read time
1 min read
Version
v1.0.0
Confidence
established
Last updated

Quick Reference

Electron IPC: Always use contextBridge with contextIsolation:true. Never expose raw ipcRenderer. One method per IPC channel. Use invoke/handle for request-response. Validate senders with event.senderFrame.url. Sandbox preloads (default Electron 20+). Whitelist channels, validate all data.

Use When

  • Building Electron desktop apps
  • Main-renderer process communication
  • Exposing Node APIs to frontend
  • Securing Electron applications

Skip When

  • Web-only applications
  • Tauri applications

Electron IPC Patterns

Secure Electron IPC patterns using contextBridge, preload scripts, and type-safe communication between main and renderer processes.

Tags

electron ipc desktop security typescript

Discussion