Electron中使用http://协议而不是file://的安全问题?

时间:2018-09-20 11:21:00

标签: node.js security electron

我们一直在使用渲染器中的Angular开发Electron应用程序,并且主要有一些后台任务服务。我们最近从使用index.html协议加载file://开始改变。我们只是决定在解决方案中实施Google跟踪代码管理器,并且使用http://使实施变得更加容易,因为我们的分析专家可以更轻松地跟踪他们感兴趣的事件,而无需与开发人员联系以了解一些Analytics Universal的内容,每次我们要跟踪新内容时,都不必重新部署应用程序。

但是,当我们使用以下命令加载http://localhost:8888时(我们有一个Express服务器正在监听并传递文件)

win.loadURL(url.format({
  pathname: 'localhost:9696',
  protocol: 'http:',
  slashes: true
}));

我们在开发控制台中收到警告:

Electron Security Warning (Node.js Integration with Remote Content) This renderer process has Node.js integration enabled and attempted to load remote content. This exposes users of this app to severe security risks.

For more information and help, consult https://electronjs.org/docs/tutorial/security.
This warning will not show up once the app is packaged.
warnAboutNodeWithRemoteContent @node_modules/electron/dist/resources/electron.asar/renderer/security-warnings.js:145
loadHandler @node_modules/electron/dist/resources/electron.asar/renderer/init.js:173
12:59:08.193 

我的问题基本上是:这些警告严重吗?还是我们可以忽略它们?我试图弄清楚用户不使用SSL即可访问本地主机的风险。拥有自签名证书似乎有点多余。尤其是因为电子应用程序可以解压缩并且每个人都可以访问证书。如何提高安全性?通过https://访问所有外部内容(仅图像)。

0 个答案:

没有答案