-
Notifications
You must be signed in to change notification settings - Fork 507
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 CSP issue #173
Comments
If this is an issue with Firefox, then why do the scripts work in Tampermonkey? Or does Tampermonkey use some kind of workaround? |
Because it has modified the CSP header. And this seems to be the only solution on Firefox if Firefox won't grant permission for extensions to inject scripts. |
Upstream Bug 1267027. |
FWIW I'm currently working around this using an addon to modify the CSP per-page (slightly modified from the original Chrome extension). E.g. to get GitHub Dark as a userscript to work, we add in
|
I can ditch Tampermonkey now! Cheers @angelsl ! |
FYI, Normally this issue should be fixed in the latest Firefox Nightly. EDIT: Please disregard, the script #172 still doesn't work in Violentmonkey. |
Edit: never mind, it is not always applicable -- only under very specific configurations (that I cannot identify) can I run userscripts.
|
With both bug 1407056 and bug 1406278 fixed this should now work correctly. For example testing the script from #172 on github everything seems correct with Firefox 58 (2017-10-20). @gera2ld can you confirm? |
Not work. Even in Tampermonkey CSP hack is required. |
The changes in question will only land in FF 58. You may wish to try the next Nightly containing those changes. |
I'm on Build ID 20171021100029 |
Is this script not working related to the CSP issues? Extract images for Twitter Works with Tampermonkey and Greasemonkey 4, but not Violentmonkey. Also not on latest Nightly. |
Actually I was wrong, it still doesn't seem to work. Both the github script and the twitter script for extracting images above still run into CSP issues.
Maybe the way Violentmonkey injects scripts could be changed. |
Checkout evilpie@18f5c60. This seems to make the script from #172 work for me. Extract images for Twitter also works, but it seems a bit broken, but this is probably unrelated to the CSP issue. The fix is to use |
It's broken again since a day or two :( Had to use @angelsl workaround again |
@gera2ld
|
What would be the biggest hurdle in moving over to As far as I can tell:
Otherwise, I don't currently use Chrome, so I haven't looked into whether it suffers from the same problem. But I would prefer not to disable CSP restrictions for an entire domain, even though that is a workaround I suppose. |
By using |
Yeah, you're right; forgot that I'd still be happy with even a limited way to get scripts interacting with CSP-blocked domains, since right now the alternative is nothing works at all; but since Firefox is theoretically still planning to just make CSP not apply to injected scripts, it's probably more efficient for me to just bug them about it. |
I can't run userscripts on github.com, although everything works on Chromium. Has anyone found a solution? @angelsl :) |
Set |
Doesn't work :( |
Having the same problem while trying to activate a style script on Mastodon sites. Injection mode auto doesn't help and I still get this in the logs:
|
Use GM_addStyle or GM_addElement. |
Hm, I tried this:
Doesn't cut it, unfortunately. |
Meanwhile, the workaround is to add the style element manually: const el = document.createElement('style');
el.textContent = `.......`;
(document.head || document.documentElement).appendChild(el); Note that it works because the script is automatically injected in |
Firefox does not support script injection from extension when page has CSP restrictions. As a result, no script can be injected to such pages in Firefox. But it works well with Chrome.
Related issues:
#107, #172
Some examples suffered from this issue:
The text was updated successfully, but these errors were encountered: