Skip to content
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

8346094: Harden X509CertImpl.getExtensionValue for NPE cases #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ksreenath-ora
Copy link

@ksreenath-ora ksreenath-ora commented Feb 24, 2025

Earlier code will trigger NPE if the certificate does not contain the extensions or if the requested extensions does not exist. The better approach for hardening getExtensionValue here is to to check for NULL explicitly before calling getExtensionValue() and avoding try-catch block which ensures the readability and maintainability.

After scanning in multiple places where invokng getExtensions on the X509CertInfo reference, the check for NULL is added in the getKeyUsage() as well while calling before getExtensionValue()

The associated tests are written and added in test class CertificateExtensions. Which will ensure to validate the
getExtensionValue() and getKeyUsage() methods in X509CertImpl class.


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
  • JDK-8346094 needs maintainer approval

Issue

  • JDK-8346094: Harden X509CertImpl.getExtensionValue for NPE cases (Bug - P4 - Approved)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 88

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk24u/pull/88.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 24, 2025

👋 Welcome back ksreenath-ora! 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.

@openjdk
Copy link

openjdk bot commented Feb 24, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 24, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 24, 2025

Webrevs

@openjdk
Copy link

openjdk bot commented Feb 25, 2025

@ksreenath-ora Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information.

@ksreenath-ora ksreenath-ora changed the title 8350554: Harden X509CertImpl.getExtensionValue for NPE cases Backport 70a6c0b7ac952eebdffa1d64399cd0ee1efec1f6 Feb 25, 2025
@openjdk openjdk bot changed the title Backport 70a6c0b7ac952eebdffa1d64399cd0ee1efec1f6 8346094: Harden X509CertImpl.getExtensionValue for NPE cases Feb 25, 2025
@openjdk
Copy link

openjdk bot commented Feb 25, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added the backport label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

1 participant