-
Notifications
You must be signed in to change notification settings - Fork 55
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
Remove subject common name parsing #169
Conversation
429a316
to
8aa5b09
Compare
Codecov Report
@@ Coverage Diff @@
## main #169 +/- ##
=======================================
Coverage 96.70% 96.71%
=======================================
Files 15 16 +1
Lines 4549 4532 -17
=======================================
- Hits 4399 4383 -16
+ Misses 150 149 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more 📢 Have feedback on the report? Share it here. |
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.
Here's some initial feedback. Thanks again for running with this 🎉 It will be really nice to put another nail in the subject common name coffin.
As suggested by @cpu in this comment thread: rustls#169 (comment)
dd6e00e
to
5194bd8
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.
Some thoughts on how to make the commit history a bit cleaner...
5194bd8
to
9cf25e7
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.
Yup, this is great! I'd probably have kept the extraction/move of test utils in a separate commit, but that doesn't matter as much.
BTW, the content of the changes looks great, some nice simplification here.
This commit adds a pair of tests reproducing issue rustls#167, where the `EndEntityCert::dns_names()` method returns an error incorrectly on some certificate DER encodings. In particular, `dns_names` fails if the CN is a `PrintableString`, or if it's an empty `SEQUENCE`, rather than a `SEQUENCE` containing an empty `SET`. The test for the `PrintableString` common name uses an end-entity certificate generated using `rcgen`, while the test for empty `SEQUENCE` CN required a hand-crafted DER using `ascii2der`. The text file that generated the `ascii2der` cert is also included.
As suggested by @ctz in this comment: rustls#167 (comment).
This commit removes parsing of the subject common name field from `NameIterator`, since `rustls-webpki` does not actually verify subject common names except when enforcing name constraints. This fixes issues with common names in formats that `rustls-webpki` doesn't currently support, by removing this code entirely. Fixes rustls-webpki/webpki#167
9cf25e7
to
a863348
Compare
Ah, yeah, probably should have pulled that out, my bad! Oh well --- not sure if it can be easily changed now. Also, I had to force-push again after noticing a clippy lint on an earlier commit, so if you don't mind, it looks like CI will need to be re-approved. |
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.
Nice work!
I'm going to leave this unmerged overnight to give ctz a chance to do a review in case he's interested. If it isn't merged or reviewed by the time I log back on east-coast morning time tomorrow. I'll go ahead and merge. |
@cpu Sounds good to me! We would love to be able to get a release with this fixed, of course. But, since it looks you all are in the middle of getting v0.102.0 ready , we can definitely take a Git dependency in the meantime. Thanks so much for all your guidance on figuring out the issue and how to fix it, I really appreciate it! |
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 great, thanks!
@hawkw if you want to do a backport to 0.101.x we'd be happy to review and merge that, but other than that, taking on a rustls alpha release might make sense? Will require some other changes though (but would be great to have early feedback on those anyway). Backport probably won't be completely trivial, this code changed a bunch since 0.101. |
I'm working on a 0.101.x release branch, I can take a look at folding this in. |
It wasn't too bad to backport 👍 #170 |
Thank you, that's wonderful! I would've been fine with a Git dep on the alpha, so thank you for going out of your way to do that! |
Currently,
rustls-webpki
fails to parse common names names from certificates where the subject common name is not aUTF8String
, or aSEQUENCE
containing an emptySET
. This is incorrect, as some spec-compliant encoders may emitPrintableString
rather thanUTF8String
, and may represent an empty subject common name as an emptySEQUENCE
, rather than aSEQUENCE
of emptySET
. This results in issues while iterating over the subject alternate names of such a certificate, as described in #167.Rather than changing the common name parsing to support such cases, the simplest solution to these issues is to remove common name parsing entirely. As explained by @cpu in #167 (comment):
Therefore, this branch does the following:
PrintableString
(a53c3ee) and where the CN is an emptySEQUENCE
(c075316),rustls-webpki
entirely (ac1740c and 429a316)Fixes #167