首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >拒绝白名单脚本的内容安全策略

拒绝白名单脚本的内容安全策略
EN

Stack Overflow用户
提问于 2018-03-03 13:39:30
回答 1查看 189关注 0票数 1

我将youtube API域列入了CSP标头的白名单,但它仍然拒绝该脚本。

CSP报头

代码语言:javascript
复制
default-src 'self'; script-src 'self' https://youtube.com/iframe_api s.ytimg.com; style-src 'self' ; img-src 'self' https://i.ytimg.com; font-src 'self'; connect-src 'self'; media-src 'self'; object-src 'none' ; child-src 'none' ; frame-src https://wwww.youtube.com ; worker-src 'self' ; frame-ancestors 'none' ; form-action 'self' ; upgrade-insecure-requests; block-all-mixed-content; disown-opener; sandbox allow-scripts allow-same-origin; reflected-xss block; manifest-src 'self' ; referrer no-referrer;

错误

代码语言:javascript
复制
Refused to load the script 'https://www.youtube.com/iframe_api' because it violates the following Content Security Policy directive: "script-src 'self' https://youtube.com/iframe_api s.ytimg.com".
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-03 14:35:22

通过使用strict-dynamic和随机数解决了这个问题

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49081069

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档