跳至主要內容

BrowserView window.open() 漏洞修復

·一分鐘閱讀

發現了一個程式碼漏洞,允許在子視窗中重新啟用 Node。


使用 sandbox: truenativeWindowOpen: truenodeIntegration: false 開啟 BrowserView 會導致 webContents,其中可以呼叫 window.open,並且新開啟的子視窗將啟用 nodeIntegration。此漏洞會影響所有支援的 Electron 版本。

緩解措施

我們已發佈包含此漏洞修復的新版 Electron:2.0.173.0.153.1.34.0.45.0.0-beta.2。我們鼓勵所有 Electron 開發人員立即將他們的應用程式更新到最新的穩定版本。

如果由於某些原因您無法升級您的 Electron 版本,您可以透過停用所有子網頁內容來緩解此問題

view.webContents.on('-add-new-contents', (e) => e.preventDefault());

更多資訊

此漏洞由 PalmerAL 發現並負責地報告給 Electron 專案。

若要了解更多關於確保您的 Electron 應用程式安全的最佳實務,請參閱我們的安全教學課程

如果您想報告 Electron 中的漏洞,請發送電子郵件至security@electronjs.org