You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Why does validators.email include localhost in the domain whitelist? #142
changed the title [-]Why does validators.email include `localhost` in the domain whitelist?[/-][+]Why does validators.email include localhost in the domain whitelist?[/+]on Feb 20, 2020
some times may need localhost or even single word to be an available domain. e.g. use enter an local address . (mypc:8080, localhost:8080, 127.0.0.1:8080)
validators.domain('localhost') returns failure.
Additionally, this should be made explicit -- localhost is not a valid domain. It never should be a valid domain, particularly in production when validating URLs.
The only mention of localhost in rfc 2606 is here: https://tools.ietf.org/html/rfc2606#section-2 where it specifies that *.localhost is a reserved domain for testing purposes. If somebody's use case requires a whitelist for domains that don't exist, then this should available as an option and not by default.
@InnovativeInventor thanks for response.
You are right at all. But your example is url, my scenaria is individual domain with port. So maybe I still need to write/find regular expression for it ...
Activity
[-]Why does validators.email include `localhost` in the domain whitelist?[/-][+]Why does validators.email include localhost in the domain whitelist?[/+]samuelchen commentedon Nov 18, 2020
some times may need localhost or even single word to be an available domain. e.g. use enter an local address . (mypc:8080, localhost:8080, 127.0.0.1:8080)
validators.domain('localhost') returns failure.
InnovativeInventor commentedon Nov 18, 2020
@samuelchen : https://github.com/kvesteri/validators/blob/7fe92bd2ad1765d6e8e24d6aa6e6cad3434c9aa9/tests/test_url.py#L59-L60
Additionally, this should be made explicit --
localhostis not a valid domain. It never should be a valid domain, particularly in production when validating URLs.The only mention of localhost in rfc 2606 is here: https://tools.ietf.org/html/rfc2606#section-2 where it specifies that
*.localhostis a reserved domain for testing purposes. If somebody's use case requires a whitelist for domains that don't exist, then this should available as an option and not by default.samuelchen commentedon Nov 19, 2020
@InnovativeInventor thanks for response.
You are right at all. But your example is url, my scenaria is individual domain with port. So maybe I still need to write/find regular expression for it ...
nandgator commentedon Mar 3, 2023
conflicts #185
maint: update `email` module