Hostname validation is security checking that compares a requested name against policy before a network action is allowed. The policy may be an allowlist, a set of approved domains, or rules that block internal, loopback, or unexpected destinations. The goal is to make sure software connects only to hosts it is meant to trust.
This matters because many attacks exploit mismatches between what an application thinks it approved and what the resolver or network stack actually uses. If validation is weak, an attacker may bypass outbound controls, trigger server-side request forgery, or redirect traffic to an untrusted target. Good defenses validate the normalized hostname, not just the raw user input, and they re-check the final destination after DNS resolution. Case folding, trailing dots, IDN/punycode handling, and resolver behavior all need careful testing.


