Idna resource reduction using a length check#247
Merged
saghul merged 6 commits intosaghul:masterfrom Jul 19, 2025
Merged
Conversation
saghul
approved these changes
Jul 18, 2025
Owner
saghul
left a comment
There was a problem hiding this comment.
Thanks! Could you please add a test perhaps?
Contributor
Author
Sure I would love to ^^ |
Contributor
Author
|
I reformatted and sorted test files with isort & ruff hope you don't mind. |
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.
There's a small possibility that this library is vulnerable to CVE-2024-3651 since pycares allows versions of idna that are lower than 3.7 to be used. I have added in a special check to ensure that this resource attack will never happen since specially crafted inputs by an attacker can be a future problem to someone who may for example write a DNS website with python only to later have an attacker launch a very sophisticated payload. Domains can only be a size of 253 characters which is the maximum so knowing that I added in a security check to say that if any part is greater than 253 raise a
RuntimeError. If you think I should put this check somewhere else in the function please let me know.