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
validators.hostname lets long hostnames through if they contain periods #413
>>> long_name_with_periods = 'kld8MXQh6YalMqKRbfs895gMjW5T4p2EwToPoCSThPHHbXgmXc.kld8MXQh6YalMqKRbfs895gMjW5T4p2EwToPoCSThPHHbXgmXc.kld8MXQh6YalMqKRbfs895gMjW5T4p2EwToPoCSThPHHbXgmXc.kld8MXQh6YalMqKRbfs895gMjW5T4p2EwToPoCSThPHHbXgmXc.kld8MXQh6YalMqKRbfs895gMjW5T4p2EwToPoCSThPHHbXgmXcab'
>>> assert len(lon_name_with_periods) > 255 # should be too long regardless of whether the dot-delimited "phrases" are <63chars
>>> assert validators.hostname(long_name_with_periods) # Slips through the cracks
Maybe this has to do with the _simple_hostname_regex function?
Fixed by #461: the 253-character limit is now enforced on the IDNA-encoded name (so it counts octets, with one optional trailing dot ignored), and the exact example from this issue is rejected. Regression tests, including this example and the IDN case, landed in #493. Thanks for the report!
Activity
nandgator commentedon May 1, 2025
See: #407 (comment)
nandgator commentedon Oct 10, 2026
Fixed by #461: the 253-character limit is now enforced on the IDNA-encoded name (so it counts octets, with one optional trailing dot ignored), and the exact example from this issue is rejected. Regression tests, including this example and the IDN case, landed in #493. Thanks for the report!