【问题标题】:Why configure Cordova config.xml if I already have a CSP in index.html如果我在 index.html 中已经有 CSP,为什么还要配置 Cordova config.xml
【发布时间】:2019-03-07 23:17:16
【问题描述】:

所以我的 index.html 中已经有以下标记:

content="base-uri *; object-src 'none'; script-src 'self' 'sha256-LOml7W8v08pQhD4vcNTjNY+cvcYQV/kKF3Zhx8Ht2gc=' 'sha256-F9BbcOryafEGOcifHtySkTo4WqryjpUUKUEFIg2xMQ4='; style-src 'unsafe-inline' 'self'; default-src 'none'; manifest-src 'self'; connect-src https://*.mywebsite.com ws://*.mywebsite.com wss://*.mywebsite.com https://api.mixpanel.com https://www.google-analytics.com; frame-src 'self' some.other.website; font-src 'self'; img-src *.mywebsite.com 'self' data: https:; media-src 'self' *.mywebsite.com">

这已经相当严格了。

我们现在正在迁移到科尔多瓦。问题是:

  1. 由于我们的 index.html 中已经有一个严格的 CSP,并且cordova 似乎可以正确应用它,我们是否需要在 config.xml 中进行任何配置
  2. 如果我们确实需要在 config.xml 中配置某些内容,那么在给定 CSP 的情况下我们应该配置什么(请注意,我们希望允许我们的 cordova 应用重定向到任何域)。

提前致谢

【问题讨论】:

    标签: android ios cordova phonegap content-security-policy


    【解决方案1】:

    您无需在 config.xml 中配置任何内容,除非您打算展示来自 YouTube 等流媒体网站的视频。

    在我的config.xml 中,我必须直接在<widget> 中添加这个:

    <access origin="*" />

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-03
      • 2022-12-06
      • 2022-01-16
      • 1970-01-01
      • 2017-11-13
      • 1970-01-01
      • 2010-09-12
      • 1970-01-01
      相关资源
      最近更新 更多