Page 1 of 1

noscript refuses to trust localhost

Posted: Thu Mar 15, 2018 9:56 am
by frpatte
Bonjour,

I am facing a problem, I can't access my dlna server on my own machine (localhost). I have the emby server installed on my computer and when I want to connect (localhost:8096), noscript blocks the access. If I try to mark the page as trusted, a small locker appears saying "match https content only". And I can't do anything to unlock this page.....

Thank you for helping.

F.P.

Re: noscript refuses to trust localhost

Posted: Thu Mar 15, 2018 11:26 am
by skriptimaahinen
Enabling "List full addresses in the permissions popup (https://www.noscript.net)" in the Appearance options makes the localhost line visible again.

The purpose of the empty line is unclear to me though.

Re: noscript refuses to trust localhost

Posted: Thu Mar 15, 2018 2:07 pm
by frpatte
Ok! Thank you, this done the job.

F.P.

Re: noscript refuses to trust localhost

Posted: Fri Mar 16, 2018 12:15 pm
by skriptimaahinen
Turns out the empty line is supposed to be the domain line for the localhost, but since tld.js doesn't recognize localhost as valid top level domain, the line is left empty.

tld.js behaviour is bit odd though, as the next tests show:

input -> returns
"localhost" -> ""
"localhost:8000" -> ""
"http://localhost" -> ""
"http://localhost:8000" -> "http://localhost:8000"
"foo.localhost" -> "foo.localhost"
"foo.localhost:8000" -> "foo.localhost:8000"

Luckily there appears to be an easy fix for our problem. Simply add one line as shown below.

Code: Select all

tld.js

getDomain(domain) {
    if (domain == "localhost") return domain; // added line
    if (this.isIp(domain)) return domain;
    ...
This should be OK as long as getDomain is fed only hostnames, so the port number or protocol are not going to be issues. Alternatively you could get fancy with regexps, or update the tld.js. The newer version seems to have feature to import custom hostnames like localhost.

Re: noscript refuses to trust localhost

Posted: Fri Mar 16, 2018 2:15 pm
by barbaz
This affects all no-dot domains, not just localhost.

NoScript Classic solved this by always showing only the full address for no-dot domains, regardless of the setting to show full addresses.

Re: noscript refuses to trust localhost

Posted: Fri Mar 16, 2018 11:45 pm
by Giorgio Maone
Included the localhost exception in latest development build, likely will switch to classic's approach in 10.1.7.4.
v 10.1.7.3rc1
=============================================================
x Fixed infinite script count report loops on some sites
(thanks AuntyJack, @ALoss2 and others for reporting)
x Fixed localhost not being recognized as a domain (thanks
skriptimaahinen for patch)

x Fixed regression causing NOSCRIPT element and META refreshes
not to be emulated anymore on script-disabled pages (thanks
barbaz and fatboy for reporting)