小编Mrt*_*ten的帖子

如何安全地将 script-src 与已知的 JSONP 端点托管商(例如 syndicate.twimg.com)结合起来?

我正在使用嵌入推文的页面的内容安全策略,并且我收到了 的报告https:/\xe2\x80\x8b/\xe2\x80\x8bcdn.syndication.twimg.com,这在我的策略中是不允许的。

\n\n

这是一个相当长的政策,但相关部分是

\n\n
default-src \'none\'; ... script-src \'self\' apis.google.com platform.twitter.com; ...\n
Run Code Online (Sandbox Code Playgroud)\n\n

但是,如果我将cdn.syndication.twimg.com或添加*.twimg.com到标头的一部分,当我通过Google CSP 评估器script-src运行标头时,我会收到警告:

\n\n
\n

cdn.syndication.twimg.com已知托管允许绕过此 CSP 的 JSONP 端点。

\n
\n\n

其他一些域也会引发此警告。

\n\n

看来我进退两难:要么我不允许 Twitter 运行脚本(需要吗?我真的不知道)并收到违反政策的报告,要么我正在运行一个几乎无用的脚本客户服务提供商。

\n\n

有办法摆脱这个难题吗?

\n

jsonp content-security-policy

5
推荐指数
1
解决办法
2149
查看次数

标签 统计

content-security-policy ×1

jsonp ×1