Electron contextBridge: limiting ipcRenderer.invoke to specific IPC channels
Electron's contextBridge is the supported way to expose IPC from a sandboxed preload script to the renderer, but the shape of that exposure is left as a design decision. With contextIsolation enabled (the default since Electron 12) and nodeIntegration disabled, the renderer can only reach what the preload explicitly exposes through contextBridge.exposeInMain