NS blocking SmartSearch JS bookmarklet execution
NS blocking SmartSearch JS bookmarklet execution
SmartSearch opens keyworded bookmarklets, based on the selected text, in a new tab. If the keyworded bookmarklet is a javascript one "javascript:alert('%s')", NS blocks its execution. The new tab opens with the right JS url, but it doesn't get executed. Without NS, it runs.
Fx 3.6.13, NS 2.0.8.1
Fx 3.6.13, NS 2.0.8.1
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NS blocking SmartSearch JS bookmarklet execution
Probably WONTFIX.
NoScript needs to patch the bookmark system in order to get bookmarklets to execute.
If SmartSearch called into the bookmark API, it would likely work, but they seem to open the URL directly which, in this case, cause the JavaScript to run with a null principal which NoScript needs to block, obviously.
NoScript needs to patch the bookmark system in order to get bookmarklets to execute.
If SmartSearch called into the bookmark API, it would likely work, but they seem to open the URL directly which, in this case, cause the JavaScript to run with a null principal which NoScript needs to block, obviously.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Re: NS blocking SmartSearch JS bookmarklet execution
Please reassess this in light of Fx 6.0 ban on javascript:. The workaround of manual reissuing of a smartsearch attempted, and blocked by NS, javascript: navigation will no longer work. Is there anything you can do? A javascript: url is being opened from privileged code so it should be allowed, if possible. If not, can you suggest something for smartsearch that will work in the presence of NS?Giorgio Maone wrote:Probably WONTFIX.
NoScript needs to patch the bookmark system in order to get bookmarklets to execute.
If SmartSearch called into the bookmark API, it would likely work, but they seem to open the URL directly which, in this case, cause the JavaScript to run with a null principal which NoScript needs to block, obviously.
Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NS blocking SmartSearch JS bookmarklet execution
They could use Components.utils.Sandbox to emulate JavaScript URL execution (that's what NoScript does for bookmarklet execution on non-whitelisted pages).
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Re: NS blocking SmartSearch JS bookmarklet execution
I emailed the author. So there is no way to know that a javascript url is being opened from privileged code (an extension calling openUILinkIn)? Also, you mentioned bookmark API, did you mean that it supports the invocation of bookmarks (something like: bookmark.open('keyword_arg', 'tab') as opposed to extracting the bookmark data and issuing the navigating oneself?Giorgio Maone wrote:They could use Components.utils.Sandbox to emulate JavaScript URL execution (that's what NoScript does for bookmarklet execution on non-whitelisted pages).
Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NS blocking SmartSearch JS bookmarklet execution
Yes there is, but I should patch yet another browser function (fragile!) just to support this very rare use case.al_9x wrote: So there is no way to know that a javascript url is being opened from privileged code (an extension calling openUILinkIn)?
More or less, yes.al_9x wrote: it supports the invocation of bookmarks (something like: bookmark.open('keyword_arg', 'tab') as opposed to extracting the bookmark data and issuing the navigating oneself?
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Re: NS blocking SmartSearch JS bookmarklet execution
I guess I was hoping that it could be patched once at a sufficiently low level to catch all possible javascript: url openings from privileged code.Giorgio Maone wrote:Yes there is, but I should patch yet another browser function (fragile!) just to support this very rare use case.al_9x wrote: So there is no way to know that a javascript url is being opened from privileged code (an extension calling openUILinkIn)?
Please point to it. So if they used this api, instead, it would work with NS? Is that not better than the sandbox?Giorgio Maone wrote:More or less, yes.al_9x wrote: it supports the invocation of bookmarks (something like: bookmark.open('keyword_arg', 'tab') as opposed to extracting the bookmark data and issuing the navigating oneself?
Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NS blocking SmartSearch JS bookmarklet execution
Address bar JavaScript (which we don't want to allow) is "javascript: url opening from privileged code", and at that level it cannot be discriminated anymore.al_9x wrote:I guess I was hoping that it could be patched once at a sufficiently low level to catch all possible javascript: url openings from privileged code.Giorgio Maone wrote:Yes there is, but I should patch yet another browser function (fragile!) just to support this very rare use case.al_9x wrote: So there is no way to know that a javascript url is being opened from privileged code (an extension calling openUILinkIn)?
Any PlacesUIUtils method which calls checkURLSecurity() will do.al_9x wrote:Please point to it. So if they used this api, instead, it would work with NS? Is that not better than the sandbox?Giorgio Maone wrote:More or less, yes.al_9x wrote: it supports the invocation of bookmarks (something like: bookmark.open('keyword_arg', 'tab') as opposed to extracting the bookmark data and issuing the navigating oneself?
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Re: NS blocking SmartSearch JS bookmarklet execution
To defend this use case, the ability to process text from pages with parameterized javascript bookmarklets, transform it and make arbitrary requests based on it, is a pretty powerful extensibility mechanism, there is value in preserving it. Sure it's an advanced feature, but so is NS for the most part, so it's NS users who are more likely to use and miss it.Giorgio Maone wrote:Yes there is, but I should patch yet another browser function (fragile!) just to support this very rare use case.
I debugged it a bit. It looks like you are patching loadURI. If you patch one "level" lower, loadURIWithFlags, you should be able to:Giorgio Maone wrote:Address bar JavaScript (which we don't want to allow) is "javascript: url opening from privileged code", and at that level it cannot be discriminated anymore.
- intercept the SmartSearch load(openUILinkIn->openLinkIn->loadOneTab->addTab->loadURIWithFlags), fixing this issue
- know when the nav is user typed javascript (javascript: url and LOAD_FLAGS_DISALLOW_INHERIT_OWNER flag set)
- here's a nice bonus, you could optionally strip/ignore the LOAD_FLAGS_DISALLOW_INHERIT_OWNER flag, overriding the 6.0 ban on user typed javascript: this would be a welcome feature apart from this issue
I don't think openNodeIn (or anything else there) supports parameterized invocation, does it? Doesn't look like that's an option.Giorgio Maone wrote:Any PlacesUIUtils method which calls checkURLSecurity() will do.
Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0
Re: NS blocking SmartSearch JS bookmarklet execution
loadURIWithFlags patching is also needed to make built-in keyword bookmarklet invocation work in 6.0.
Mozilla/5.0 (Windows NT 5.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NS blocking SmartSearch JS bookmarklet execution
Fixed in latest development build 2.1.2.4rc2.
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Re: NS blocking SmartSearch JS bookmarklet execution
When addTab calls loadURIWithFlags on an a newly created browser, you haven't replaced loadURIWithFlags yet. Is it possible for you to somehow get at it earlier? I noticed they are dispatching a TabOpen event prior to calling loadURIWithFlags, can that help?Giorgio Maone wrote:Fixed in latest development build 2.1.2.4rc2.
The good news, is that with allowURLBarJS the manual workaround works. By the way, I think many would be happy to know that NS now has an option to override the 6.0 urlbar js ban, you should advertise that somehow.
Mozilla/5.0 (Windows NT 5.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1
- Giorgio Maone
- Site Admin
- Posts: 9527
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: NS blocking SmartSearch JS bookmarklet execution
I'm investigating the cleanest way to do this early enough, thanks.
Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0