Issue #2863: fix — exclude domains with underscores in the domain name.

This commit is contained in:
Steven Black
2025-04-12 11:52:28 -04:00
parent f4235aced3
commit 21f7f0a933
2 changed files with 3 additions and 0 deletions

View File

@@ -847,6 +847,7 @@ class TestNormalizeRule(BaseStdout):
"0.0.0.0 https",
"0.0.0.0 https..",
"0.0.0.0 foo.",
"0.0.0.0 this_that.com",
]:
self.assertEqual(normalize_rule(rule, **kwargs), (None, None))

View File

@@ -1133,6 +1133,7 @@ def normalize_rule(rule, target_ip, keep_domain_comments):
or "." in hostname[-1]
or "/" in hostname
or ":" in hostname
or "_" in hostname
):
# Example: 0.0.0.0 127.0.0.1
@@ -1143,6 +1144,7 @@ def normalize_rule(rule, target_ip, keep_domain_comments):
# - ends in a dot, or
# - contains a slash, or
# - contains a colon,
# - contains an underscore,
# we don't want to normalize it.
return belch_unwanted(rule)