2014-04-21 87 views
0

這是來自我的Chrome擴展。Chrome擴展中的內容安全策略問題

"permissions": [ 
"storage", 
"https://app.socialschools.nl/*", 
"http://*.google.com/", // Refer to http://goo.gl/CPeqK http://goo.gl/U3Vev 
"bookmarks", // http://code.google.com/chrome/extensions/bookmarks.html 
"chrome://favicon/", 
"clipboardRead", // document.execCommand('paste'). 
"clipboardWrite", // document.execCommand('copy' OR 'cut') 
"contextMenus", //http:///code.google.com/chrome/extensions/contextMenus.html 
"cookies", // http://code.google.com/chrome/extensions/cookies.html 
// "experimental", // http://code.google.com/chrome/extensions/dev/experimental.html 
"fileBrowserHandler", // http://goo.gl/GqbrP 
"geolocation", // http://dev.w3.org/geo/api/spec-source.html 
"history", // http://code.google.com/chrome/extensions/history.html 
"idle", // http://code.google.com/chrome/extensions/idle.html 
"management", // http://code.google.com/chrome/extensions/management.html 
"notifications", // code.google.com/chrome/extensions/notifications.html 
"tabs", // http://code.google.com/chrome/extensions/tabs.html +windows.html 
"tts", // http://code.google.com/chrome/extensions/tts.html 
"ttsEngine", // http://code.google.com/chrome/extensions/ttsEngine.html 
"unlimitedStorage" 
], 

"content_security_policy":"script-src 'unsafe-eval' https://apps.socialschools.nl/;object-src 'self';connect-src https://app.socialschools.nl/", 

我加入了兩個劇本-SRC,權限的API URL(https://app.socialschools.nl)和連接-SRC。仍然,我得到這個錯誤:

Refused to load the script 'https://app.socialschools.nl/apiv1/public/924/post/?callback=jQuery16200253…109_1398087409246&only_descendants=false&number_of_items=5&_=1398087409299' because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' https://apps.socialschools.nl/". 

我似乎無法理解我在這裏失蹤?有人可以幫我解決這個問題。

在此先感謝。

+0

你把'apps'而不是'app'。 – rsanchez

回答

1

我發現API尚不支持HTTPS,而CSP的腳本src需要HTTPS用於外部源。因此,內容安全策略存在問題。

+0

該網站託管在Heroku上,因此您可以嘗試使用https:// socialschools-production.herokuapp.com/apiv1/public/924/post /'代替。 – abraham

+0

感謝您的建議!但由於它受限於一個域(app.socialschools.nl),它給了我一個內部服務器錯誤。 –