single label hosts (localhost) shown/whitelisted with scheme
Posted: Sat Aug 07, 2010 11:04 am
http://localhost instead of just localhost, why?
NoScripters and WebSec nerds of all lands, unite!
https://forums.informaction.com/
Code: Select all
<html>
<head>
<script>
function evHandler(e)
{
dump(e.type + '\n');
}
function writeFrame()
{
var w = document.getElementById('child').contentWindow;
w.document.open();
w.addEventListener('load', evHandler, false);
w.addEventListener('DOMContentLoaded', evHandler, false);
w.document.write('doc.written');
w.document.close();
}
</script>
</head>
<body>
<button onclick="writeFrame();">write frame</button>
<iframe id="child"></iframe>
</body>
</html>
Code: Select all
<script src="http://localhost:81/"></script>
CAPS is an implementation detail as you mentioned, it does not dictate what you show in the menu, that's entirely up to you.Giorgio Maone wrote:These are all glitches due to CAPS implementation details: if a domain contains no dots, it needs the protocol to be specified in order to match.
Of course cosmetic changes can be done in order to make the UI less confusing and CAPS disappear in the background as much as possible, but here's the reason you're asking for.
These are implementation details, what you show in the menu is under your control, and need not impact what happens behind the scenes. If "full addresses" is not set, you should show "localhost" in the menu, how it appears in the whitelist is a different story.Giorgio Maone wrote:Forgot to tell: there's a very good reason why http://localhost is shown instead of localhost for "Allow" commands: the browser has currently no way to tell whether localhost (or any other 1 component domain name) is a public internet suffix (TLD) or an arbitrary internal domain name, because nsIEffectiveTLDService.getPublicSuffix() returns the string itself both for "localhost" and for "com".
At this point, why NoScript doesn't display an "Allow localhost" command is quite obvious, isn't it?
If I show "localhost", I must show "com" or "org" as well.al_9x wrote:These are implementation details, what you show in the menu is under your control, and need not impact what happens behind the scenes. If "full addresses" is not set, you should show "localhost" in the menu, how it appears in the whitelist is a different story.Giorgio Maone wrote:Forgot to tell: there's a very good reason why http://localhost is shown instead of localhost for "Allow" commands: the browser has currently no way to tell whether localhost (or any other 1 component domain name) is a public internet suffix (TLD) or an arbitrary internal domain name, because nsIEffectiveTLDService.getPublicSuffix() returns the string itself both for "localhost" and for "com".
At this point, why NoScript doesn't display an "Allow localhost" command is quite obvious, isn't it?
http://localhost duplication is still thereGiorgio Maone wrote:The issues would could reasonably be worked-around have been in latest development build.
Why must you? I don't understand the difficulty, this is just a question of presentation. I am not asking you to change any underlying behavior, just how single label domains are displayed in the menu.Giorgio Maone wrote:If I show "localhost", I must show "com" or "org" as well.
Because there's no way to tell "localhost" apart of "com", "org", "net" and so on.al_9x wrote:Why must you?Giorgio Maone wrote:If I show "localhost", I must show "com" or "org" as well.
Code: Select all
<script src="http://com/fake.js"></script>
<script src="http://localhost/some-script.js"></script>
Code: Select all
Allow http://com
Allow http://localhost
Code: Select all
Allow com
Allow localhost
ok got it you don't want to imply that you are allowing the whole tld for the edge case that the host name matches a tld, well the tld list is well defined http://data.iana.org/TLD/tlds-alpha-by-domain.txt you can make exceptions for themGiorgio Maone wrote:Because there's no way to tell "localhost" apart of "com", "org", "net" and so on.al_9x wrote:Why must you?Giorgio Maone wrote:If I show "localhost", I must show "com" or "org" as well.