4 ms·
doesn't look like a security vulnerability, just a regex issue when he's trying to parse the domain via the URL. perhaps he could start to parse the URL at the
by nick007 17y ago
doesn't look like a security vulnerability, just a regex issue when he's trying to parse the domain via the URL.
perhaps he could start to parse the URL at the last (and usually first) occurrence of the protocol tag... assuming that this is a common error by submitters and worth coding a fix for.
- profquail 17y agoI think the 'solution' will depend on how paranoid you want to be about security. You could count the occurrences of protocol tags and if it's more than one, don't allow the user to submit it -- however, this would break some url redirectors and print pages. Or, you could do what you said, and check the string for consecutive protocol tags, then discard all of them except the last one. Since there is a fairly low volume of new links that need to be checked, PG could simply add a few lines of code that send an HTTP HEAD request to the url and see if it's really a valid link before accepting it (or try a HEAD, then a GET if that fails, in case the webserver doesn't handle HEAD requests properly). I think that would be the most flexible solution.