小编rea*_*ney的帖子

Nuxt.js 中的内容安全策略

有没有人成功地将 CSP 添加到 Nuxt 应用程序?

我尝试过Helmet,但它似乎与 nuxt.config.js 文件不兼容。

还尝试在 Nuxt的Render 属性上添加 csp ,但在某些脚本需要 nonce 时遇到了问题。

这是我的 nuxt.config.js 中 Render 属性的要点,这对吗?

你如何在 Nuxt 中生成随机数?

render: {
    csp: {
      hashAlgorithm: 'sha256',
      policies: {
        'script-src': [
          'self',
          'unsafe-inline',
          'http://assets.adobedtm.com',
          'https://cdn.polyfill.io/',
          'https://www.everestjs.net',
          'https://www.google-analytics.com',
          'http://localhost:8001',
          "'sha256-<hash>'"
        ],

      },
      reportOnly: false,
      addMeta: true
    }
  },
Run Code Online (Sandbox Code Playgroud)

nonce content-security-policy vue.js nuxt.js

10
推荐指数
1
解决办法
1799
查看次数

标签 统计

content-security-policy ×1

nonce ×1

nuxt.js ×1

vue.js ×1