Page 1 of 1

How to block inline userscript (greasemonkey)?

Posted: Fri Aug 01, 2014 12:10 am
by 100
Guys,

Big fan of NoScript and first time posting, please excuse if this is not the right forum and point me to the right direction.

I noticed that some tracking codes/websites have inline GreaseMonkey/UserScript such as Tumblr tracker Unfollower Hater. On one website, where it was probably poorly inserted, I saw nearly 500 lines of GreaseMonkey related javascript embedded in it toward the end / after the end html tag.

My question: is there a way to block execution of all inline GreaseMonkey/UserScript scripts within a page/domain?

Thanks,

Re: How to block inline userscript (greasemonkey)?

Posted: Fri Aug 01, 2014 3:41 am
by Thrawn
I don't understand. Greasemonkey scripts are provided by *you*. If they're not doing what you want, then change them.

Scripts provided by the site are not Greasemonkey/user scripts.

Re: How to block inline userscript (greasemonkey)?

Posted: Fri Aug 01, 2014 3:44 am
by barbaz
@100: I went to that site and I'm not seeing what you're seeing. Can you post one such script here? (wrap in code tags please)
Also, other than NoScript, what addons (& versions) do you have?

Re: How to block inline userscript (greasemonkey)?

Posted: Fri Sep 19, 2014 7:59 pm
by oakoi
I'm curious, I want to know if it possible to allow Greasemonkey script to run but disable the website's script. Although some userscript/Greasemonkey does work without enabling NoScript on that domain some/most userscript will not function properly.

Re: How to block inline userscript (greasemonkey)?

Posted: Fri Sep 19, 2014 8:05 pm
by barbaz
I don't think Greasemonkey can do that (not sure, because I've never gotten it to work at all), but Scriptish can in most cases.

Also, NoScript has a feature surrogate scripts that can run conditionally based on site permissions status.

Re: How to block inline userscript (greasemonkey)?

Posted: Sat Sep 20, 2014 3:30 am
by oakoi2
I might have wrote it in a confusing way.

I mean like so (example):

Using NoScripts:
Allow "mozilla.com" (using NoScript) so it mean it can run everything, JavaScript (website) and JavaScript (user / greasemonkey) , Plugins, HTML5(?)

What I essentially want to do is like so;

Allow "mozilla.com" (using NoScript) so it mean it can run everything, JavaScript (website) and JavaScript (user / greasemonkey) , Plugins, HTML5(?)
"Limited" Allow "firefox.com", e.g. Only allow JavaScript (user / greasemonkey), block everything else.

If you did understood what I was asking and answer with the surrogate solution, then I apologize. It just seem a bit complicated and annoying to use.

Re: How to block inline userscript (greasemonkey)?

Posted: Sat Sep 20, 2014 3:34 am
by barbaz
Oh, sorry for the misunderstanding. It would have helped if you started a new thread for that, because your question is unrelated to the OP.
Anyway, the option you're looking for is
NoScript Options > Embeddings > Apply these restrictions to whitelisted sites too

To whitelist sites for plugin content, use
about:config -> noscript.allowedMimeRegExp

Re: How to block inline userscript (greasemonkey)?

Posted: Mon Sep 22, 2014 3:11 am
by Thrawn
barbaz wrote: Anyway, the option you're looking for is
NoScript Options > Embeddings > Apply these restrictions to whitelisted sites too
Actually, I don't think that that is what oakoi wants...s/he wants to run userscript without allowing the domain's own scripts.

And the answer is, if the userscript runs in the page context, then there is no way for NoScript to tell them apart, whereas if it runs in a privileged context, then it's allowed already.

Re: How to block inline userscript (greasemonkey)?

Posted: Mon Sep 22, 2014 5:28 am
by barbaz
Thrawn wrote:
barbaz wrote: Anyway, the option you're looking for is
NoScript Options > Embeddings > Apply these restrictions to whitelisted sites too
Actually, I don't think that that is what oakoi wants...s/he wants to run userscript without allowing the domain's own scripts.

And the answer is, if the userscript runs in the page context, then there is no way for NoScript to tell them apart, whereas if it runs in a privileged context, then it's allowed already.
@Thrawn: That is the question I answered with this post

Re: How to block inline userscript (greasemonkey)?

Posted: Thu Sep 25, 2014 12:49 am
by oakoi2
Thank you. Having to use create rules each time via about:config is rather time consuming, I guess I will go make a request in NoScript Wishlist.

Considering how the thread is related to what I wanted to know I did not think creating a new thread was appropriate.

Re: How to block inline userscript (greasemonkey)?

Posted: Thu Sep 25, 2014 4:17 am
by barbaz
oakoi2 wrote:Having to use create rules each time via about:config is rather time consuming
In what way?
If it's because of minifying the code to fit it into the pref, you could put the surrogate script's file: URL instead of the JS code. But note that changes to the script don't take effect immediately in that case.
oakoi2 wrote:Considering how the thread is related to what I wanted to know I did not think creating a new thread was appropriate.
My apologies for the misunderstanding, when I said that I didn't realize that you weren't asking something like "how do I allow only some (Temp)Allowed sites to run plugin content".