(*) Fix bug in EdgeDomain where it would permit domains with a trailing period, DNS style.

This commit is contained in:
Viktor Lofgren 2023-12-29 16:36:01 +01:00
parent ea73be6831
commit 6aee27a3f1

View File

@ -23,6 +23,12 @@ public class EdgeDomain implements Serializable {
host = host.toLowerCase();
// Remove trailing dots, which are allowed in DNS but not in URLs
// (though sometimes still show up in the wild)
while (!host.isBlank() && host.endsWith(".")) {
host = host.substring(0, host.length() - 1);
}
var dot = host.lastIndexOf('.');
if (dot < 0 || looksLikeAnIp(host)) { // IPV6 >.>