-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8336665: CCE in X509CRLImpl$TBSCertList.getCertIssuer #20528
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
|
👋 Welcome back mpowers! A progress list of the required criteria for merging this PR into |
|
@mcpowers This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 1529 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
|
Need to update copyright on X509CRLImpl.java. |
| X500Name issuerDN = (X500Name) names.get(0).getName(); | ||
| X500Name issuerDN; | ||
| try { | ||
| issuerDN = (X500Name) names.get(0).getName(); |
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.
Use instanceof X500Name here to see if it is the right type instead of catching the ClassCastException.
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.
Fixed. Good Idea.
| GeneralNames names = ciExt.getNames(); | ||
| X500Name issuerDN = (X500Name) names.get(0).getName(); | ||
| if (!(names.get(0).getName() instanceof X500Name issuerDN)) { | ||
| throw new CRLException("Parsing error: bad X500 issuer"); |
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.
Suggest a slight rewording of the error message: "Parsing error: issuer is not an X.500 DN"
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.
Fixed.
| if (!(names.get(0).getName() instanceof X500Name issuerDN)) { | ||
| throw new CRLException("Parsing error: " | ||
| + "issuer is not an X.500 DN"); | ||
| } |
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 checked RFC 5280 and you can have more than one name in the CertificateIssuer field of the CertificateIssuerExtension, see https://www.rfc-editor.org/rfc/rfc5280#section-5.3.3
But for this code, we are only interested in the X500Name, as we subsequently use that to associate the CRL entry with its issuer. So instead, what you should do is loop thru the names until we find an X500Name, and only throw a CRLException if we don't find an X500Name. Let me know if this makes sense.
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.
Fixed.
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.
Does the test need to be modified to test for more than one name? I could go either way.
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.
Are you able to easily create test CRLs with more than one entry? If not, I think the existing test is ok.
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 know how to create a CertificateIssuerExtension with multiple names but I haven't connected the dots as to how to add it to a CRL for testing. It would be an interesting exercise but probably not worth the effort.
| } | ||
| } | ||
| throw new CRLException("Parsing error: " | ||
| + "issuer is not an X.500 DN"); |
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.
To be more precise, I suggest changing this message to "CertificateIssuer field does not contain an X.500 DN".
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.
Fixed.
|
|
||
| // "class sun.security.x509.OIDName cannot be cast | ||
| // to class sun.security.x509.X500Name" | ||
| byte[] encoded_1 = Base64.getDecoder().decode(""" |
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.
Could you add some comments before this line and line 59 as to what is in the CRL that makes the format invalid? (Ex: This CRL contains a CertificateIssuerExtension that is not compliant with RFC 5280 because it does not contain a DN)
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.
The CRL is being constructed from a fuzzed data input stream. All I know is that the name in the CertificateIssuerExtension looks like an x509.OIDName in the first test, and in the second test it looks like an x509.X400Address.
I can add these two comments to the test:
"Fuzzed data input stream looks like an x509.OIDName." and
"Fuzzed data input stream looks like an x509.X400Address.".
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.
Yes, I think that would be helpful, but also say that these are in the CertificateIssuerExtension so it is more clear what part of the CRL is being tested for parsing issues.
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.
Fixed.
|
/integrate |
|
Going to push as commit ca1700b.
Your commit was automatically rebased without conflicts. |
https://bugs.openjdk.org/browse/JDK-8336665
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20528/head:pull/20528$ git checkout pull/20528Update a local copy of the PR:
$ git checkout pull/20528$ git pull https://git.openjdk.org/jdk.git pull/20528/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20528View PR using the GUI difftool:
$ git pr show -t 20528Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20528.diff
Webrev
Link to Webrev Comment