英文:
Reasons for having fonts.gstatic.com in the csp-report - without having the external URL inside the HTML/JS?
问题
我实施了内容安全策略(Content-Security-Policy,CSP),并使用report-uri
参数来跟踪策略的违规情况。
在跟踪违规情况时,我注意到了这样的条目:
"csp-report": {
"document-uri": "https://www.example.com/",
"referrer": "",
"violated-directive": "font-src",
"effective-directive": "font-src",
"disposition": "enforce",
"blocked-uri": "https://fonts.gstatic.com/s/mulish/v12/1Ptvg83HX_SGhgqk0AotcqA.woff2",
"status-code": 200,
"script-sample": ""
}
奇怪的是,在HTML、JavaScript文件以及CSS文件中,我都没有使用任何外部字体。它们都没有外部URL。
正如您所见,script-sample
也是空的。
我猜想可能是用户的浏览器扩展将字体注入到网站中,然后被CSP阻止了。还有其他可能吗?
英文:
I implemented a Content-Security-Policy (CSP) and use the report-uri
parameter to track violations of the policy.
While tracking the violations I have noticed such entries:
"csp-report": {
"document-uri": "https://www.example.com/",
"referrer": "",
"violated-directive": "font-src",
"effective-directive": "font-src",
"disposition": "enforce",
"blocked-uri": "https://fonts.gstatic.com/s/mulish/v12/1Ptvg83HX_SGhgqk0AotcqA.woff2",
"status-code": 200,
"script-sample": ""
}
The strange thing is that neither in the HTML, nor the Javascript files, nor in the CSS files I am using any external font. They are all clean from external URLs.
As you can see the script-sample
is also empty.
I assume that it could be a browser extension of the user that injects the font into the website, which then gets blocked by CSP.
What else could it be?
答案1
得分: 1
我发现了这个很棒的CSP违规收集:https://github.com/nico3333fr/CSP-useful/blob/master/csp-wtf/explained.md
其中一个看起来与我发现的类似。
"blocked-uri": "https://fonts.gstatic.com/s/opensans/v13/PRmiXeptR36kaC0GEAetxko2lTMeWA_kmIyWrkNCwPc.woff2",
可能与允许个性化字体的扩展相关,例如Font Changer。
这总比没有好。
如果其他人发现违规的另一个来源,请在这里发布。
英文:
I found this nice collection of CSP violations: https://github.com/nico3333fr/CSP-useful/blob/master/csp-wtf/explained.md
One seems to be similar to the one I discovered.
"blocked-uri": "https://fonts.gstatic.com/s/opensans/v13/PRmiXeptR36kaC0GEAetxko2lTMeWA_kmIyWrkNCwPc.woff2",
> Might be related to extension that allow to personalize fonts, like Font Changer
This is better than nothing.
If someone else discovers another source of the violation, please post it here.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论