在csp-report中包含fonts.gstatic.com的原因 – 而不在HTML/JS中包含外部URL?

huangapple go评论53阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月6日 16:59:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76412985.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定