-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-23033: consider wildcard in left most segment only for domain names #937
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
Conversation
Looks like there is a relevant failing |
@alex review now. |
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.
I have a few small comments.
Thanks for working on this! This is a great improvement to making match_hostname
behave more like the rest of the PKI infrastructure.
Lib/ssl.py
Outdated
if wildcards > max_wildcards: | ||
if wildcards == 1 and len(leftmost) > 1: | ||
""" Only match wildcard in leftmost segment. | ||
""" |
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.
Nit: Please use a #
style comment. """
is for docstrings.
Lib/test/test_ssl.py
Outdated
@@ -480,10 +480,10 @@ def fail(cert, hostname): | |||
fail(cert, 'Xa.com') | |||
fail(cert, '.a.com') | |||
|
|||
# only match one left-most wildcard | |||
# only match wildcard in left-most segment |
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.
This comment still doesn't fell right, there is a wildcard in the left-most segment. I think it should say something like "only match wildcards when they are the only thing in the left-most segment". What do you think?
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.
Sounds much better, pushing the changes.
Doc failures are not your fault, sphinx-doc/sphinx#3597 is the cause. |
@alex anything else needed from my side ? |
This looks good to me. I'll probably ask for another review before landing. Thanks so much! |
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.
Looks good to me. Wildcards should be honored iff they are the leftmost fragment and are the only character in that fragment.
You are almost there! Please add a |
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.
versionchanged in documentation is missing.
@tiran version changed docs added. Should that go in |
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.
31c911b
to
2416d6a
Compare
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.
I think we also need to add an entry to Misc/NEWS
.
Doc/whatsnew/3.7.rst
Outdated
@@ -273,6 +273,10 @@ Changes in the Python API | |||
``makedirs()``. | |||
(Contributed by Serhiy Storchaka in :issue:`19930`.) | |||
|
|||
* Now wildcard is supported in hostname when it is one and only character in the | |||
left most segment of hostname in second argument of :meth:`match_hostname`. |
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.
I'd change :meth:`match_hostname` to :meth:`ssl.match_hostname`. This would create a link to the ssl.match_hostname()
documentation.
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.
@berkerpeksag thanks for review. I have pushed a fix.
Misc/NEWS
Outdated
@@ -313,6 +313,9 @@ Extension Modules | |||
Library | |||
------- | |||
|
|||
- bpo-23033: Now wildcard is supported in hostname when it is one and only | |||
character in the left most segment of hostname. |
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 add "Patch by Mandeep Singh."
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.
done.
Please add yourself to Misc/ACKS, resolve the conflict and update Misc/NEWS. |
@Mariatta changes pushed. |
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
@Mariatta will update the PR tonight. |
@Mariatta I have rebased the PR and added news entry in Misc/NEWS.d/ |
Thanks. I made minor changes and added you to Misc/ACKs. Waiting until CI is done. |
Thanks again @daxlab and congrats on your first contribution to CPython 🌮 |
https://bugs.python.org/issue23033