Allow URI by regex?

Ask for help about NoScript, no registration needed to post
User avatar
Lucas Malor
Senior Member
Posts: 71
Joined: Tue Nov 09, 2010 2:01 pm
Contact:

Allow URI by regex?

Post by Lucas Malor »

Is there a way to allow a particular URI using a regular expression?

I want to allow a single static page on my computer, but I do not want to allow the whole file:/// "protocol"
Last edited by GµårÐïåñ on Sun Dec 06, 2015 10:54 pm, edited 1 time in total.
Reason: spelling
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Allow URI by regex?

Post by Thrawn »

In short: not easily.

You could try serving the page via Apache? It's pretty easy to set up.
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
barbaz
Senior Member
Posts: 11161
Joined: Sat Aug 03, 2013 5:45 pm

Re: Allow URI by regex?

Post by barbaz »

Well, you can Temporarily allow file:// and load *only* the one file in the browser session.

But the way that NoScript works, being geared toward security - either you trust a site or you don't... and if you don't trust your own filesystem, then you have a MUCH bigger problem than NoScript can handle!!!!!!!!!!!!!!!!!!!!! :o :o
*Always* check the changelogs BEFORE updating that important software!
-
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Allow URI by regex?

Post by Thrawn »

barbaz wrote:if you don't trust your own filesystem
Well, let's not go too far; it's quite reasonable to have downloaded various files from sites with varying degrees of trustworthiness, and want to run script in some but not others.

What kind of a static page are we talking about?
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Luke42

Re: Allow URI by regex?

Post by Luke42 »

Sorry to dig out this old thread...

Is this still current/true? I have the same problem, i want to allow Javascript on some specific local files only (custom startpage in Firefox for example) but i don't want to allow file:// globally.

If this is still not possible, any other solutions? I thought about maybe using Greasemonkey in some way, because GM-Code will run even with JS disabled, but i'm not sure it would work (and how) and it feels like an ugly hack. Something with a local webserver could work but it feels quite overkill and i don't know anything about Apache and stuff.

Any ideas?
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
barbaz
Senior Member
Posts: 11161
Joined: Sat Aug 03, 2013 5:45 pm

Re: Allow URI by regex?

Post by barbaz »

Luke42 wrote:Is this still current/true?
Yes.
Luke42 wrote:i don't want to allow file:// globally.
Why not?
Luke42 wrote:If this is still not possible, any other solutions?
1) Fix your filesystem so that you can trust it.

2) Set up Apache or nginx and run a local server.

3) Create a simple Firefox extension that contains only the one page (and whatever external files it needs). Then your page should be accessible from a URI that is allowed by default.
*Always* check the changelogs BEFORE updating that important software!
-
Luke42

Re: Allow URI by regex?

Post by Luke42 »

Thank you for your quick answer!
barbaz wrote:
Luke42 wrote:i don't want to allow file:// globally.
Why not?
As Thrawn mentionned some people (including myself) sometimes download suspect html-files (like from links in spam/phishing-mails) to analyze, i don't want their JS running if i'm not carefull and open them while file:// is allowed (and if i want to use my trusted local files file:// would be allowed all the time so i would have to disable it before opening a non-trusted file, way to risky).
Luke42 wrote:If this is still not possible, any other solutions?
1) Fix your filesystem so that you can trust it.
see above
2) Set up Apache or nginx and run a local server.
Yeah, maybe i will need to have a look at all this stuff.
3) Create a simple Firefox extension that contains only the one page (and whatever external files it needs). Then your page should be accessible from a URI that is allowed by default.
That could be a solution indeed. I don't know anything about FF-extensions but i suppose it's not too difficult and probably better than a webserver. I will dig into this as soon as i have some time. Thank you for the suggestion.
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0
Post Reply