Skip to content

Conversation

@mcpowers
Copy link
Contributor

@mcpowers mcpowers commented Aug 9, 2024

https://bugs.openjdk.org/browse/JDK-8336665


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8336665: CCE in X509CRLImpl$TBSCertList.getCertIssuer (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20528/head:pull/20528
$ git checkout pull/20528

Update a local copy of the PR:
$ git checkout pull/20528
$ git pull https://git.openjdk.org/jdk.git pull/20528/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20528

View PR using the GUI difftool:
$ git pr show -t 20528

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20528.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 9, 2024

👋 Welcome back mpowers! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@mcpowers mcpowers changed the title CCE in X509CRLImpl$TBSCertList.getCertIssuer 8336665: CCE in X509CRLImpl$TBSCertList.getCertIssuer Aug 9, 2024
@openjdk
Copy link

openjdk bot commented Aug 9, 2024

@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:

8336665: CCE in X509CRLImpl$TBSCertList.getCertIssuer

Reviewed-by: mullan

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 master branch:

  • 7af46a6: 8340554: Improve MessageFormat readObject checks
  • 7d5eefa: 8342862: Gtest added by 8339507 appears to be causing 8GB build machines to hang
  • d8c3b0f: 8342768: GTest AssemblerX86.validate_vm failed: assert(VM_Version::supports_bmi1()) failed: tzcnt instruction not supported
  • 3c14c2b: 8341566: Add Reader.of(CharSequence)
  • b0ac633: 8342075: HttpClient: improve HTTP/2 flow control checks
  • 85774b7: 8342882: RISC-V: Unify handling of jumps to runtime
  • 2c31c8e: 8339730: Windows regression after removing ObjectMonitor Responsible
  • f0b130e: 8339296: Record deconstruction pattern in switch fails to compile
  • e96b4cf: 8342387: C2 SuperWord: refactor and improve compiler/loopopts/superword/TestDependencyOffsets.java
  • f7a61fc: 8342931: ProblemList failing tests from JDK-8335912
  • ... and 1519 more: https://git.openjdk.org/jdk/compare/1b1dba8082969244effa86ac03c6053b3b0ddc43...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 9, 2024
@openjdk
Copy link

openjdk bot commented Aug 9, 2024

@mcpowers The following label will be automatically applied to this pull request:

  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the security security-dev@openjdk.org label Aug 9, 2024
@mlbridge
Copy link

mlbridge bot commented Aug 9, 2024

@mcpowers
Copy link
Contributor Author

mcpowers commented Aug 9, 2024

Need to update copyright on X509CRLImpl.java.

X500Name issuerDN = (X500Name) names.get(0).getName();
X500Name issuerDN;
try {
issuerDN = (X500Name) names.get(0).getName();
Copy link
Member

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.

Copy link
Contributor Author

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");
Copy link
Member

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines 289 to 292
if (!(names.get(0).getName() instanceof X500Name issuerDN)) {
throw new CRLException("Parsing error: "
+ "issuer is not an X.500 DN");
}
Copy link
Member

@seanjmullan seanjmullan Sep 24, 2024

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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");
Copy link
Member

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".

Copy link
Contributor Author

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("""
Copy link
Member

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)

Copy link
Contributor Author

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.".

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 24, 2024
@mcpowers
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 24, 2024

Going to push as commit ca1700b.
Since your change was applied there have been 1530 commits pushed to the master branch:

  • d1540e2: 8342090: Infer::IncorporationBinaryOp::equals can produce side-effects
  • 7af46a6: 8340554: Improve MessageFormat readObject checks
  • 7d5eefa: 8342862: Gtest added by 8339507 appears to be causing 8GB build machines to hang
  • d8c3b0f: 8342768: GTest AssemblerX86.validate_vm failed: assert(VM_Version::supports_bmi1()) failed: tzcnt instruction not supported
  • 3c14c2b: 8341566: Add Reader.of(CharSequence)
  • b0ac633: 8342075: HttpClient: improve HTTP/2 flow control checks
  • 85774b7: 8342882: RISC-V: Unify handling of jumps to runtime
  • 2c31c8e: 8339730: Windows regression after removing ObjectMonitor Responsible
  • f0b130e: 8339296: Record deconstruction pattern in switch fails to compile
  • e96b4cf: 8342387: C2 SuperWord: refactor and improve compiler/loopopts/superword/TestDependencyOffsets.java
  • ... and 1520 more: https://git.openjdk.org/jdk/compare/1b1dba8082969244effa86ac03c6053b3b0ddc43...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 24, 2024
@openjdk openjdk bot closed this Oct 24, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 24, 2024
@openjdk
Copy link

openjdk bot commented Oct 24, 2024

@mcpowers Pushed as commit ca1700b.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mcpowers mcpowers deleted the JDK-8336665 branch October 28, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated security security-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

2 participants