Skip to content

Commit 8c27633

Browse files
Merge pull request #41 from netascode/perf/ipv6-colon-precheck
perf: add colon pre-check before running IPv6 regex
2 parents 4f4f05d + 9273b1e commit 8c27633

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

nac_sanitizer/engine/ip_scanner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def _is_ipv4(value: str) -> bool:
3636

3737
def _is_ipv6(value: str) -> bool:
3838
"""Check if a string looks like an IPv6 address or prefix."""
39+
if ":" not in value:
40+
return False
3941
match = _IPV6_PATTERN.match(value)
4042
if not match:
4143
return False

0 commit comments

Comments
 (0)