【发布时间】:2017-01-09 19:48:09
【问题描述】:
我已经在我的应用程序上实施了内容安全策略,现在它在仅报告模式下进行测试。在适当调整政策后,我得到了很多类似这样的报告:
{
"csp-report": {
"blocked-uri": "self",
"document-uri": "https://example.com/path/to/app/page.php",
"original-policy": "script-src 'nonce-DrZQpFyD2k9sGWT5' https://example.com https://ajax.googleapis.com https://maps.googleapis.com; default-src https://example.com; style-src https://example.com 'unsafe-inline' https://maxcdn.bootstrapcdn.com; img-src * data:; font-src https://example.com https://maxcdn.bootstrapcdn.com; frame-src https://example.com; frame-ancestors https://example.com; form-action *; report-uri https://<>.report-uri.io/r/default/csp/reportOnly",
"script-sample": "onmouseout attribute on DIV element",
"source-file": "https://example.com/path/to/app/page.php?id=143",
"violated-directive": "script-src 'nonce-DrZQpFyD/k9sGWT5' https://example.com https://ajax.googleapis.com https://maps.googleapis.com https://code.jquery.com/ "
}
}
该应用程序的大多数用户使用 Chrome,但这些报告完全来自 Firefox。有时脚本示例会显示onmouseover 或其他一些鼠标事件。我查看了应用程序中的所有代码,没有任何地方使用属性鼠标事件。
关于造成这种情况的任何想法?
【问题讨论】:
-
任何外部包含的使用鼠标事件的代码,例如 Google Analytics?
-
@cdhowie 触发违规报告的页面上唯一外部包含的代码是 jQuery UI,但我还没有看到来自 Edge、IE 或 Chrome 的违规行为。
标签: javascript firefox content-security-policy