Add additional internal TLDs to domain validation

This commit is contained in:
Maurus Decimus
2026-06-06 11:46:45 +02:00
parent bfd8e2cfc6
commit bdd7f74ebd
2 changed files with 13 additions and 1 deletions

View File

@@ -354,7 +354,18 @@ pub fn sanitize_domain(domain: &str) -> Option<String> {
}
pub fn is_valid_domain(domain: &str) -> bool {
const RESERVED_TLDS: &[&str] = &["test", "localhost", "local", "internal"];
const RESERVED_TLDS: &[&str] = &[
"test",
"localhost",
"local",
"internal",
"lan",
"home",
"corp",
"intranet",
"private",
"localdomain",
];
psl::domain(domain.as_bytes()).is_some_and(|d| d.suffix().typ().is_some())
|| RESERVED_TLDS.contains(&domain)
|| domain