Page 1 of 1
can i allow a specific script but not all scripts?
Posted: Thu Jan 24, 2013 10:10 pm
by user
hello,
i would like, if it is possible, to use noscript to allow one(!) specific script from a website/domain? The key point is that i do not want to allow all scripts from one host but only a single script.
Example:
I open a webpage. NoScript is configured to block everything and displays in the status bar that the page, for example, has two scripts (which are blocked of course).
a) Is there a possibility to click and view these two srcipts in their javascript source from the NoScript status bar? (I know that i can use mozilla to display the pages HTML source and also search and look at the srcipts.)
b) Is there a possibility to tell NoScript to allow one of the two scripts? All i find is the option to allow all scripts from one domain. I would like to have an option to view, evaluate and then allow a specific script to be executed. But only this script which i have evaluated and found to be safe.
ciao
Re: can i allow a specific script but not all scripts?
Posted: Fri Jan 25, 2013 7:34 am
by Tom T.
Yes.
Use the
JSView add-on. Open its menu and observe the very specific and detailed script names. You may double-click any specific script to read its actual code.
For example, among the 100+ scripts currently running in my Yahoo Mail are these:
Code: Select all
http://mail.yimg.com/zz/combo?/nq/mc/15_0_8/js/im_blue_all.js&/nq/mc/15_0_8/js/us_strings.js&/nq/mc/15_0_8/js/msgr.js
http://yui.yahooapis.com/3.1.1/build/loader/loader-min.js
Suppose for some reason I wish to allow the first, but not the second. Then use NoScript's ABE feature (if not familiar,
ABE FAQ) to create a script-specific rule:
Code: Select all
Site http://yui.yahooapis.com/3.1.1/build/loader/loader-min.js
Deny
Of course, with Yahoo generally running about 100 scripts whenever I"m in email, it could get a bit tedious. But for your example of two scripts from a source, and blocking one, this should do it. Let us know how it works for you, or if you need any more help.
Re: can i allow a specific script but not all scripts?
Posted: Fri Jan 25, 2013 11:55 am
by user
hi tom,
thanks for your quick and informative reply. JSView looks quite useful and handy. Also i learned some stuff about ABE now.
However, my question was rather with respect to srcipts directly defined in the HTML code like for the example below:
<script type="text/javascript">
// some code for script 1
</script>
<script type="text/javascript">
// some code for script 2
</script>
Would it be possible to allow only script1 but not script2?
As an alternative solution: Would it be possible to "tell" NoScript to allow script1 and script2 but not any other script from the same server/domain.
ciao
Re: can i allow a specific script but not all scripts?
Posted: Sat Jan 26, 2013 2:12 am
by Thrawn
user wrote:my question was rather with respect to srcipts directly defined in the HTML code like for the example below:
<snip>
As an alternative solution: Would it be possible to "tell" NoScript to allow script1 and script2 but not any other script from the same server/domain.
Hmm...there's no way for ABE to distinguish between different parts of the same file, and the regular script-blocking is strictly domain-based.
You could try an ABE rule like this (at the end of your USER ruleset) to allow inline scripts but block script imports:
Code: Select all
Site ALL
Deny INCLUSION(SCRIPT) from site-with-inline-scripts.com
Re: can i allow a specific script but not all scripts?
Posted: Sat Jan 26, 2013 4:23 am
by Tom T.
Thrawn wrote:Hmm...there's no way for ABE to distinguish between different parts of the same file, and the regular script-blocking is strictly domain-based.
You could try an ABE rule like this (at the end of your USER ruleset) to allow inline scripts but block script imports:
Code: Select all
Site ALL
Deny INCLUSION(SCRIPT) from site-with-inline-scripts.com
I could be mistaken, but I believe OP is referring strictly to inline scripts, "defined in the HTML code", rather than to scripts imported via a link, albeit a link inside the same domain/site.
@ user: Am I correct? For example, at this site I see a script in the page source code, the one that starts with
Code: Select all
<script type="text/javascript">
// <
. I could try this if I get time...not really my area of expertise, but if I come up with something, I'll post it.
Re: can i allow a specific script but not all scripts?
Posted: Mon Jan 28, 2013 6:14 am
by Tom T.
Thrawn wrote:Tom T. wrote:
I could be mistaken, but I believe OP is referring strictly to inline scripts, "defined in the HTML code", rather than to scripts imported via a link, albeit a link inside the same domain/site.
Well, I was responding to this:
As an alternative solution: Would it be possible to "tell" NoScript to allow script1 and script2 but not any other script from the same server/domain.
If I understand user correctly, s/he would like to allow inline scripts, but block imported ones, even from the same domain. Hence my suggested ABE rule, which would block all script imports from that domain, but would not touch inline scripts.
I provided a way of using ABE to block linked scripts, by using JSView to get the exact full domain name and subdirectory for each script from a given domain. However, OP replied:
http://forums.informaction.com/viewtopi ... 714#p47714
However, my question was rather with respect to srcipts directly defined in the HTML code like for the example below:
<script type="text/javascript">
// some code for script 1
</script>
<script type="text/javascript">
// some code for script 2
</script>
Would it be possible to allow only script1 but not script2?
... which is different from
Code: Select all
<script type="text/javascript" src="./styles/prosilver/template/styleswitcher.js"></script>
<script type="text/javascript" src="./styles/prosilver/template/forum_fn.js"></script>
... in which the actuaL JS code is not present in the page, but rather imported from those links. Which all start with
http://forums.informaction.com, the "same domain", as can be seen by adding back the left side:
http://forums.informaction.com./styles/ ... witcher.js
http://forums.informaction.com./styles/ ... orum_fn.js
Those are perfectly clickable links - try them!

-- for which the page source code has no actual js, but calls it from those links stored elsewhere on the site's server.
Thrawn wrote:Tom T. wrote:
@ Thrawn: You contributed a fine GM script for the team to use in banning spammers. Do you think you could write a template, at least, that OP could modify for each individual page-embedded script desired?
Thanks for the compliment

. I could try this if I get time...not really my area of expertise, but if I come up with something, I'll post it.
If you were to succeed, I'd say that would be a triple (tin-foil) hat trick!
