Details
If you cannot upgrade immediately, strip the suffix before classifying by re-parsing addressMinusSuffix:
const parsed = new Address4(userInput);
const host = new Address4(parsed.addressMinusSuffix); // classify this one
A note on SSRF defense
These methods are address classifiers, not a complete SSRF defense. Regardless of this fix, a robust SSRF guard must resolve the hostname and validate the *resolved* IP against the socket it connects to, and account for DNS rebinding and redirects. Treat these checks as one layer, not the only one.
Credit
Reported by @hi-im-glitchless.