Visitar URL original
[Question] validators.domain return True on too long FQDN · Issue #407 · python-validators/validators · GitHub
Skip to content

[Question] validators.domain return True on too long FQDN #407

Description

@Osmoskour

Hey,
I don't know if this is really an issue, but according to RFC1035 section 2.3.4 (https://www.freesoft.org/CIE/RFC/1035/9.htm) , FQDN cannot be longer than 253 octets.
See also: https://devblogs.microsoft.com/oldnewthing/?p=7873

Idk if this is intentional but the actual behavior of validators.domain return True even if the FQDN is too long.


Step to reproduce:

  • Install the latest version of validators
  • Run the following code
a = "www.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.abcdefghijklmnop.fr"
print(len(a)) # 261
print(validators.domain(a)) # True

Expected behavior:

The method must return False


Actual behavior:

The method return True

Activity

  1. changed the title [-][BUG?] validators.domain return True on too long FQDN[/-] [+][Question] validators.domain return True on too long FQDN[/+] on Oct 18, 2024
  2. nandgator commented on Oct 19, 2024

    @nandgator
    Collaborator

    The Microsoft blog URL you shared, mentions that it is harder to describe the length of UTF-8 characters in octets, so if I such a have condition:

    if len(value) > 253:
        return False

    it would work, but that's not what RFC 1035, section 3.1 means.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions