[Security] Disable window.eval

As recommended by Electron warning
This commit is contained in:
Bruno Lemos
2018-12-29 21:07:43 -02:00
parent d7a95c8d3d
commit 9a0d007ae9
3 changed files with 8 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
/// <reference path="../../node_modules/electron/electron.d.ts" />
interface Window {
eval: never
ipc: Electron.IpcRenderer
process?: {
type?: string

View File

@@ -1,3 +1,5 @@
import electron from 'electron'
// Communication between webapp and electron main process
// Used on oauth flow
window.ipc = electron.ipcRenderer

View File

@@ -1,3 +1,8 @@
// Security precaution
;(window as any).eval = global.eval = () => {
throw new Error(`This app does not allow window.eval().`)
}
import '@babel/polyfill'
import 'react-app-polyfill/ie9'
import 'resize-observer-polyfill/dist/ResizeObserver.global'