Migration to Chrome Extension MV3 from MV2

61 views
Skip to first unread message

Ali Raza

unread,
Jun 22, 2022, 7:26:09 PM6/22/22
to Chromium-discuss
I made an extension in which I had content_security_policy like below in MV2
"content_security_policy": "font-src 'self' https://fonts.gstatic.com/ 'unsafe-inline'; default-src 'self'; script-src 'self' http://localhost:3000 https://cdn.segment.com 'unsafe-eval'; connect-src https://api.segment.io https://o207331.ingest.sentry.io http://localhost:3000 https://www.googleapis.com ws://localhost:9009 http://localhost:9009; style-src * 'unsafe-inline' 'self' https://fonts.googleapis.com; img-src 'self' data:;",

​And now I was migrating it to MV3 so I wrote this CSP like this
​"content_security_policy": {
  "extension_pages": "font-src 'self'; default-src http://localhost:3000 'self'; script-src http://localhost:3000 'self'; style-src 'self' 'unsafe-inline'; img-src 'self';",
  "content_scripts": "script-src 'self' http://localhost:3000 'unsafe-eval'; object-src 'self'"
},

When I run this code with searching file 'http://localhost:3000/js/recorder.bundle.js' to show popup.html, it gives following error
Video proof of Error in CSP policy

And if I download this file and put it to folder directly and then searches about it then it gives the following error

e1.png

And if I add 'unsafe-eval' in srcipt-src in CSP then it does not load the manifest with the following error

e2.png

PS. Even issues does not resolve if I do the above steps with CSP.extension_page not CSP.extension_pages

Ali Raza

unread,
Jun 27, 2022, 10:11:41 AM6/27/22
to Chromium-discuss, Ali Raza
Any updates on it please ? 
Reply all
Reply to author
Forward
0 new messages