-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-105704: Disallow square brackets ([
and ]
) in domain names for parsed URLs
#129418
Conversation
Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst
Outdated
Show resolved
Hide resolved
self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]?') | ||
self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix?') | ||
self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://user@prefix.[v6a.ip]') | ||
self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://user@[v6a.ip].suffix') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be helpful to add tests only with [
, and tests only with ]
. Such URL is also invalid, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll add tests with that structure too! Thanks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in ebf92bb
Co-authored-by: Peter Bierma <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thank you!
The failure in Windows free-threading looks unrelated, I can't merge without all the checks passing so if someone else can that would be appreciated 💜 |
Looks like that's a required to succeed. |
Thanks @sethmlarson for the PR, and @orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10, 3.11, 3.12, 3.13. |
…es for parsed URLs (pythonGH-129418) * pythongh-105704: Disallow square brackets ( and ) in domain names for parsed URLs * Use Sphinx references Co-authored-by: Peter Bierma <[email protected]> * Add mismatched bracket test cases, fix news format * Add more test coverage for ports --------- (cherry picked from commit d89a5f6) Co-authored-by: Seth Michael Larson <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
GH-129526 is a backport of this pull request to the 3.13 branch. |
GH-129527 is a backport of this pull request to the 3.12 branch. |
…es for parsed URLs (pythonGH-129418) * pythongh-105704: Disallow square brackets ( and ) in domain names for parsed URLs * Use Sphinx references Co-authored-by: Peter Bierma <[email protected]> * Add mismatched bracket test cases, fix news format * Add more test coverage for ports --------- (cherry picked from commit d89a5f6) Co-authored-by: Seth Michael Larson <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
GH-129528 is a backport of this pull request to the 3.11 branch. |
…es for parsed URLs (pythonGH-129418) * pythongh-105704: Disallow square brackets ( and ) in domain names for parsed URLs * Use Sphinx references Co-authored-by: Peter Bierma <[email protected]> * Add mismatched bracket test cases, fix news format * Add more test coverage for ports --------- (cherry picked from commit d89a5f6) Co-authored-by: Seth Michael Larson <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
GH-129529 is a backport of this pull request to the 3.10 branch. |
…es for parsed URLs (pythonGH-129418) * pythongh-105704: Disallow square brackets ( and ) in domain names for parsed URLs * Use Sphinx references Co-authored-by: Peter Bierma <[email protected]> * Add mismatched bracket test cases, fix news format * Add more test coverage for ports --------- (cherry picked from commit d89a5f6) Co-authored-by: Seth Michael Larson <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
GH-129530 is a backport of this pull request to the 3.9 branch. |
…mes for parsed URLs (GH-129418) (GH-129526) gh-105704: Disallow square brackets (`[` and `]`) in domain names for parsed URLs (GH-129418) * gh-105704: Disallow square brackets ( and ) in domain names for parsed URLs * Use Sphinx references * Add mismatched bracket test cases, fix news format * Add more test coverage for ports --------- (cherry picked from commit d89a5f6) Co-authored-by: Seth Michael Larson <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
…mes for parsed URLs (GH-129418) (GH-129527) gh-105704: Disallow square brackets (`[` and `]`) in domain names for parsed URLs (GH-129418) * gh-105704: Disallow square brackets ( and ) in domain names for parsed URLs * Use Sphinx references * Add mismatched bracket test cases, fix news format * Add more test coverage for ports --------- (cherry picked from commit d89a5f6) Co-authored-by: Seth Michael Larson <[email protected]> Co-authored-by: Peter Bierma <[email protected]>
|
…es for parsed URLs (python#129418) * pythongh-105704: Disallow square brackets ( and ) in domain names for parsed URLs * Use Sphinx references Co-authored-by: Peter Bierma <[email protected]> * Add mismatched bracket test cases, fix news format * Add more test coverage for ports --------- Co-authored-by: Peter Bierma <[email protected]>
Opening this pull request in favor of #111261, as the original author appears to not be responding to reviews. This moves the error to occur during parsing instead of on the
ParseResult
properties.cc @gpshead @orsenthil @pschoen-itsc as reviewers on the previous PR.