CodeQL 文档

启用 Electron allowRunningInsecureContent

ID: js/enabling-electron-insecure-content
Kind: problem
Security severity: 8.8
Severity: error
Precision: very-high
Tags:
   - security
   - frameworks/electron
   - external/cwe/cwe-494
Query suites:
   - javascript-code-scanning.qls
   - javascript-security-extended.qls
   - javascript-security-and-quality.qls

单击以查看 CodeQL 代码库中的查询

Electron 默认情况下通过禁止执行通过 HTTP 加载的内容来确保安全。将 webPreferences 对象的 allowRunningInsecureContent 属性设置为 true 将禁用此策略。

强烈建议不要启用不安全内容的执行。

建议

不要启用 allowRunningInsecureContent 属性。

示例

以下示例显示 allowRunningInsecureContent 被启用。

const mainWindow = new BrowserWindow({
  webPreferences: {
    allowRunningInsecureContent: true
  }
})

这是有问题的,因为它允许执行来自不受信任来源的代码。

参考资料

  • ©GitHub, Inc.
  • 条款
  • 隐私