【发布时间】:2018-08-13 04:08:51
【问题描述】:
我想在我的 React 网站中包含 Content-Security-Policy。这是我在头部添加到 index.html 的内容:
<meta http-equiv="Content-Security-Policy" content="default-src 'none';
script-src 'self' 'unsafe-inline'
https://www.google-analytics.com/
https://maps.googleapis.com/
https://developers.google.com/;
img-src 'self'
https://www.google-analytics.com
https://maps.googleapis.com/
https://maps.gstatic.com/
https://developers.google.com/ data:;
style-src 'self' https://fonts.googleapis.com 'unsafe-inline';
font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com data:;
frame-src 'self' https://www.slideshare.net;
upgrade-insecure-requests; block-all-mixed-content;
connect-src 'self'">
我使用了这个网站-https://www.htbridge.com/websec/ 来检查我的网站是否安全并且我仍然得到“F”。问题是我有很多错误配置,例如:X-FRAME-OPTIONS、X-XSS-PROTECTION、X-CONTENT-TYPE-OPTIONS 以及 CONTENT-SECURITY-POLICY。我做错了什么还是应该添加更多“设置”以确保安全?
【问题讨论】:
标签: html reactjs meta content-security-policy