-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
bpo-36216: Add check for characters in netloc that normalize to separators #12201
Conversation
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.
Please optimize import unicodedata
.
When you're done making the requested changes, leave the comment: |
sorry, GH didn't refresh. |
I'm removing the "needs backport" tags and will create the backports manually. In particular, the docs need to be slightly different for each version. I'll probably also have to come back later and add the CVE reference once we're assigned one (if we want it in there). |
netloc2 = unicodedata.normalize('NFKC', netloc) | ||
if netloc == netloc2: | ||
return | ||
_, _, netloc = netloc.rpartition('@') # anything to the left of '@' is okay |
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.
@zooba @tiran Could you tell me something about this line (it is now https://github.com/python/cpython/blob/master/Lib/urllib/parse.py#L405)? It seems to me that it exactly makes the first example from https://bugs.python.org/issue36216 fail as before:
>>> u = "https://example.com\uFF03@bing.com"
>>> urlsplit(u).netloc.rpartition("@")[2]
bing.com
https://bugs.python.org/issue36216