-
Notifications
You must be signed in to change notification settings - Fork 632
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Electron's documentation especially recommends against the pattern used in preload. They are unsafe.
electron-vite-vue/electron/preload/index.ts
Lines 4 to 24 in f06b279
| contextBridge.exposeInMainWorld('ipcRenderer', { | |
| on(...args: Parameters<typeof ipcRenderer.on>) { | |
| const [channel, listener] = args | |
| return ipcRenderer.on(channel, (event, ...args) => listener(event, ...args)) | |
| }, | |
| off(...args: Parameters<typeof ipcRenderer.off>) { | |
| const [channel, ...omit] = args | |
| return ipcRenderer.off(channel, ...omit) | |
| }, | |
| send(...args: Parameters<typeof ipcRenderer.send>) { | |
| const [channel, ...omit] = args | |
| return ipcRenderer.send(channel, ...omit) | |
| }, | |
| invoke(...args: Parameters<typeof ipcRenderer.invoke>) { | |
| const [channel, ...omit] = args | |
| return ipcRenderer.invoke(channel, ...omit) | |
| }, | |
| // You can expose other APTs you need here. | |
| // ... | |
| }) |
Documentation:
https://www.electronjs.org/docs/latest/tutorial/context-isolation#security-considerations
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
