我無法圍繞下面的CSP違規報告(由FireFox 44.0.2/Ubuntu發送)繞過我的頭。這裏真的被阻擋了,爲什麼? 應該注意的是,如果我將'self'
或(如在報告中自動翻譯)https://www.example.com
寫入CSP標題,則無關緊要。 此外,我不知道從呈現的頁面中缺少任何東西。 那麼我能對付它呢? (顯然,我不應該在我的直播網站添加報告如果每個頁面觸發一個假的違規報告)爲什麼這是CSP違規? blocked-uri = self當明確允許'self'
{
"csp-report":{
"blocked-uri":"self",
"document-uri":"https://www.example.com/foo/bar/baz.html",
"original-policy":"report-uri https://reportserver.example.com/ContentSecurityPolicy-report.php;
default-src https://www.example.com;
style-src https://example.com https://www.example.com https://fonts.googleapis.com;
script-src https://www.example.com https://code.jquery.com https://ajax.googleapis.com;
font-src https://fonts.gstatic.com",
"referrer":"https://www.example.com/foo/bar/wtf.html",
"source-file":"https://www.example.com/foo/bar/baz.html",
"violated-directive":"style-src https://example.com https://www.example.com https://fonts.googleapis.com"
}
}
這是部署在哪裏我可以看一看?根據你的描述,我想不出任何缺少Firefox中的錯誤。 – oreoshake
@oreoshake你可以在https:// www.redeker.de /'上看到這個(來自外部的「僅限報告」模式)。與此同時,我有些懷疑被阻止的內容可能是一些不安全的內聯風格,也就是'style =「...」'添加到標籤中,但是在html源代碼中不可見,因爲它被添加到每個稍後腳本(每個CSP允許腳本本身)。但如果你能證實這種懷疑,我會很高興。 –
是的,不安全的內聯是必要的。我經常發現開發者控制檯有時比報告更有用。 CSP報告有許多已知問題,並且報告內聯內容就是其中之一。 – oreoshake