Skip to content

Why does validators.email include localhost in the domain whitelist? #142

Closed

Description

@InnovativeInventor

In a normal environment, localhost should not be a valid domain name. Why can't we just let the user configure the whitelist themselves?

Why should validators default to having localhost as a valid domain name?

Activity

  1. 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
  2. samuelchen commented on Nov 18, 2020

    @samuelchen

    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.

  3. InnovativeInventor commented on Nov 18, 2020

    @InnovativeInventor
    Author

    @samuelchen : https://github.com/kvesteri/validators/blob/7fe92bd2ad1765d6e8e24d6aa6e6cad3434c9aa9/tests/test_url.py#L59-L60

    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.

  4. samuelchen commented on Nov 19, 2020

    @samuelchen

    @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 ...

  5. nandgator commented on Mar 3, 2023

    @nandgator
    Collaborator

    conflicts #185

  6. added a commit that references this issue on Mar 12, 2023
    660cf55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIssue/PR: A new featureoutdatedIssue/PR: Open for more than 3 months

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions