Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox applies the page’s CSP to extension content_scripts #6

Open
TimurBrave opened this issue Jan 8, 2022 · 2 comments
Open

Comments

@TimurBrave
Copy link

Hey man,

I hope you doing well and always have some tea/coffee to drink :)

I found out that with this extension the articles on the right side of the site devdocs.io does't load at all, instead the site show the massage:

"The page failed to load. It may be missing from the server (try reloading the app) or you could be offline (try installing the documentation for offline usage when online again).
If you're online and you keep seeing this, you're likely behind a proxy or firewall that blocks cross-domain requests."

Only when this extension is switch off the site start loading articles.

Thanks a lot man & have a great day ;)
Timur

@da2x
Copy link
Owner

da2x commented Jan 11, 2022

Firefox only. Caused by differences in how it enforces a page’s content-security-policy (CSP) for extension content_scripts injections versus Chrome. Both engines are supposed to execute the scripts in isolated_world and not the page’s context, yet Firefox applies the CSP from the page’s context to the extension’s context.

The underlying issue is somewhere in Firefox metabug #1267027-land. It’s impossible to work around or mitigate from the extension side without tweaking the every webpage’s CSP’s to allow script unsafe-inline. It shouldn’t be necessary for content_scripts, and it would never get passed extension review.

Secondarily, the site in question should catch network errors. It has a service worker to do so, it just doesn’t do anything useful with the exception (like display a network error or security message).

I can’t do anything about it.

@da2x da2x changed the title https://devdocs.io doesn't load articles Firefox applies the page’s CSP to extension content_scripts Jan 11, 2022
@mizzunet
Copy link

mizzunet commented Feb 18, 2022

@da2x, can I make this extension not to work to specified websites which are broken due to the Save Data header?
soundcloud.com for instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants