-
Notifications
You must be signed in to change notification settings - Fork 442
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] seems specially crafted CSP rules make Tampermonkey scripts fail to run #418
Comments
In normal a page's CSP should not interfere with extensions, but that's the case at Firefox. That's why TM needs to workaround this and unfortunately there is a bug. 🙄😁 Will be fixed at the next beta version at the development channel. |
I have tested a script on the beta version on both Firefox and Chrome. It is called Autopagerize, and there are certain sites that won't work on it even on beta. The script: https://greasyfork.org/en/scripts/28887-autopagerize-modified-by-blademight Sample site: http://esoaparte.com/paella_01.html |
@Tanookirby I'm sorry, but your issue is not related to CSP, but a script issue. It's even not working with Greasemonkey at the mentioned page. |
The author has fixed the issue. There is, however, another issue with sites such as https://addons.mozilla.org/en-US/firefox/extensions/?sort=hotness . In Firefox, the Autopagerize script will work on Greasemonkey but not on Tampermonkey. Because I thought this would be a CSP issue, I tested it with Tampermonkey Beta, which was said to solve the problem; and it still won't work. |
@Tanookirby, WebExtensions can't run on AMO, the browser explicitly forbids that. Just like Chrome with its own web store. |
Firefox 57.0a1, Tampermonkey 4.4.5533beta and AAK-Cont(uBlock Origin version) causes Nextcloud to be unable to load it's scripts. |
@Lartza Fixed. Please check the latest version from the development channel. |
@derjanb Can confirm 4.4.5546beta fixes the issue :) Thank you |
I'm on the latest version in the development channel and I'm getting CSP errors. I'm running Firefox Nightly build 57.0a1 (2017-09-01) (64-bit). |
@Eeems Hi, this is due to a known bug in Firefox. However, it should not break anything. If this log message bothers you, you can set "Config mode" to "Advanced" and then "Inject Mode" to "Instant" to workaround this issue. |
@derjanb it does break some scripts, not just logs. for example:
This script is supposed to add link on "x songs" that leads to large size cover art: It doesn't work in Firefox unless I changed to instant inject mode. |
Fixed at the most recent beta version: 4.5.5637beta |
I think it's may already known for you, but I still encounter CSP problem on Firefox occasionally on beta 4.6.5694. The script is this one I wrote myself: https://github.com/fireattack/scripts/blob/master/itunes_cover_art_click_to_show_original.user.js Test page: https://itunes.apple.com/jp/album/the-idolm-ster-live-the-ter-performance-01-single/1125337612 Warnings from console:
Edit: manually change to "instant" inject mode can fix it. So basically the status as I mentioned before at #418 (comment) |
Hi, the fix for this issue broke many pages. Therefore it's now a experitmental config option until the used Firefox API becomes stable. Please set "Config Mode" to "Advanced" and scroll down to the "Experimental" section and now please change "Add Tampermonkey to the sites content CSP" to "Yes". |
Chrome(vivaldi), tempermonkey 4.5(also beta 4.6.5752), "Add Tampermonkey to the sites content CSP" set to "Yes".
EDIT: never mind, read some more and CSP is a mess. I just switched from injecting DATA: blob to modifying iframe directly :/
|
@derjanb Just a quick question I'm new with TM I was using GM with Firefox but I'm migrating to Chromium and I'd like to know what is the most efficient setting for Chrome/Chromium for the CSP ? My understanding is that with the security setting to yes TM inject headers to allow Userscripts on page like github.com since Firefox don't respect the standard for CSP and scripts. If my understanding is fine this setting is mainly for Firefox and Chrome/Chromium users should set it to "NO" to diminish the useless overhead of adding/injecting headers to allow Userscripts with Chromium. Could you confirm or infirm my assumptions ? One more extra question: If I import my Userscripts with a zip file does my settings in Userscripts that use DB will be imported too ? Like here I have lot of sites saved over the years in my userscripts: Regards |
For some reason disabling uBlock Origin on the page seems to be a workaround, at least it solves this issue for me, even when using Tampermonkey's default settings (Windows 7 64bit, Firefox 60.0.1, Tampermonkey v4.6.5757). |
@mikhoul Even if scripts at Chrome should work with this option set to "No" it's better to keep it on, because it simplifies the script injection.
If the zip was created by Tampermonkey: yes. |
@Hapstyx Edit: nevermind, I can reproduce this now. |
@derjanb I use the default configuration and filters, though it seems to be caused by EasyList and not uBlock filters. Also works on Ubuntu 18.04 and Debian stretch with both Firefox Nightly and Firefox Developer Edition |
Is there an unstable version for Safari as well? I use 4.6.5757 on Safari and also (still?) have this issue... I cannot seem to find the configuration option "Add Tampermonkey to the sites content CSP". |
@one-github Safari does not support web request modification which is required to modify the CSP. :( |
@derjanb Does this mean this issue will not be solvable for Safari? |
@one-github Please see #296 |
@Hapstyx Should be fixed at TM BETA 4.7.5788 (http://tampermonkey.net/index.php?browser=firefox) |
@derjanb
|
That wouldn't help. Maybe bugzilla ticket 1353468 will be a solution. |
So 1353468 was marked as a dupe of Bugzilla ticket 1437098, which looks done or nearly so! It looks like we should be able to the new userScripts API: overview and example docs are available. (Verify in My Tampermonkey userscripts keep breaking because of CSP errors, so it would be awesome if it could move to the userScripts API. :) |
@Arthaey "Closing as resolved-fixed, because as mentioned in comment 29 the API has been already enabled by default" - am I right that Tampermonkey now needs to use that API? Asking because I am still getting CSP errors. |
I am getting CSP errors as well, and scripts fail. |
@alexolog, I had to update from |
Clearing the cache seems to have been the missing ingredient. |
I've found a site where the simpliest script just completely fails to run.
Example userscript:
Here's what is written to the browser console log:
All addon settings are at defaults (except debug level).
Any ideas how to fix it?
The text was updated successfully, but these errors were encountered: