fix hostname accepting values longer than 253 chars when they contain dots#444
Open
karthiksai109 wants to merge 1 commit intopython-validators:masterfrom
Open
fix hostname accepting values longer than 253 chars when they contain dots#444karthiksai109 wants to merge 1 commit intopython-validators:masterfrom
karthiksai109 wants to merge 1 commit intopython-validators:masterfrom
Conversation
… dots Fixes python-validators#413 The hostname validator was only checking individual label lengths via regex but had no overall length limit. Hostnames with dots that had each label under 63 chars but total length over 253 would slip through. Added a 253 character check on the host segment both with and without a port, per RFC 1123. Added a test case for this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #413
The hostname validator was only checking individual label lengths via the simple hostname regex but had no overall length limit on the full value. Hostnames with dots where each label was under 63 chars but the total length exceeded 253 would incorrectly pass validation.
Added a 253 character length check on the host segment (both with and without a port suffix) per RFC 1123. Also added a test case using the exact example from the issue.