bpo-36216: Add check for characters in netloc that normalize to separators#12201
bpo-36216: Add check for characters in netloc that normalize to separators#12201zooba merged 2 commits intopython:masterfrom
Conversation
tiran
left a comment
There was a problem hiding this comment.
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.
@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