Skip to content

8325022: Incorrect error message on client authentication#17645

Closed
johnshajiang wants to merge 2 commits intoopenjdk:masterfrom
johnshajiang:8325022
Closed

8325022: Incorrect error message on client authentication#17645
johnshajiang wants to merge 2 commits intoopenjdk:masterfrom
johnshajiang:8325022

Conversation

@johnshajiang
Copy link
Member

@johnshajiang johnshajiang commented Jan 31, 2024

If the server doesn't receive the client certificate for required client authentication, it should raise error Empty client certificate chain.


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-8325022: Incorrect error message on client authentication (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17645

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 31, 2024

👋 Welcome back jjiang! 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 openjdk bot added the rfr Pull request is ready for review label Jan 31, 2024
@openjdk
Copy link

openjdk bot commented Jan 31, 2024

@johnshajiang 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 Jan 31, 2024
@mlbridge
Copy link

mlbridge bot commented Jan 31, 2024

Webrevs

Copy link
Member

@jnimeh jnimeh left a comment

Choose a reason for hiding this comment

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

Looks good.

@openjdk
Copy link

openjdk bot commented Jan 31, 2024

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

8325022: Incorrect error message on client authentication

Reviewed-by: jnimeh, hchao, djelinski

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 12 new commits pushed to the master branch:

  • 5b9b176: 8324174: assert(m->is_entered(current)) failed: invariant
  • 0cc8e5b: 8325042: remove unused JVMDITools test files
  • f292053: 8323621: JDK build should exclude snippet class in java.lang.foreign
  • 62c9530: 8324238: [macOS] java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java fails with the shape has not been applied msg
  • 1f2922a: 8320342: Use PassFailJFrame for TruncatedPopupMenuTest.java
  • 2cd1ba6: 8324981: Shenandoah: Move commit and soft max heap changed methods into heap
  • 1733d2e: 8303374: Implement JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview)
  • 6697160: 8320712: Rewrite BadFactoryTest in pure Java
  • 725314f: 8324771: Obsolete RAMFraction related flags
  • ec6c35c: 8324970: Serial: Refactor signature of maintain_old_to_young_invariant
  • ... and 2 more: https://git.openjdk.org/jdk/compare/f7121de4a080c222e2bbf2468be94950db78530a...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 ready Pull request is ready to be integrated label Jan 31, 2024
@haimaychao
Copy link
Contributor

LGTM

Copy link
Member

@djelinski djelinski left a comment

Choose a reason for hiding this comment

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

Looks good, but could you also fix the messages on line 406 and 1227?

@johnshajiang johnshajiang changed the title 8325022: Incorrect error message on TLS 1.2 client authentication 8325022: Incorrect error message on client authentication Jan 31, 2024
Copy link
Member

@djelinski djelinski left a comment

Choose a reason for hiding this comment

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

Perfect. Thanks!

// unexpected or require client authentication
throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
"Empty server certificate chain");
"Empty client certificate chain");
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, in tls1.3 it should be certificate_required and in 1.2 handshake_failure for required auth.

rfc8446 6.2 “certificate_required: Sent by servers when a client certificate is
desired but none was provided by the client.”
rfc5246 7.4.6 “ If the client does not send any certificates, the
server MAY at its discretion either continue the handshake without
client authentication, or respond with a fatal handshake_failure
alert.”

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for raising this point.
I just filed a JBS issue: https://bugs.openjdk.org/browse/JDK-8325079

Copy link

@sbernard31 sbernard31 Apr 24, 2024

Choose a reason for hiding this comment

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

I'm not so sure about :

if (shc.sslConfig.clientAuthType !=
                        ClientAuthType.CLIENT_AUTH_REQUESTED) {
// unexpected or require client authentication

I mean cert chain should not be null/empty if CLIENT_AUTH_REQUIRED for sure.
But for CLIENT_AUTH_NONE, I don't know if this makes sense. (maybe this never happens but he comment and the code is a bit confusing)

For CLIENT_AUTH_NONE we should not receive Certificate message from client.
See tls 1.3:

The client MUST send a Certificate message if and only if the server
has requested client authentication via a CertificateRequest message

and tls 1.2:

This is the first message the client can send after receiving a
ServerHelloDone message. This message is only sent if the server
requests a certificate.

Probably should send a unexpected_message alert but this is probably elsewhere in the code ?

@johnshajiang
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Feb 1, 2024

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

  • 5b9b176: 8324174: assert(m->is_entered(current)) failed: invariant
  • 0cc8e5b: 8325042: remove unused JVMDITools test files
  • f292053: 8323621: JDK build should exclude snippet class in java.lang.foreign
  • 62c9530: 8324238: [macOS] java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java fails with the shape has not been applied msg
  • 1f2922a: 8320342: Use PassFailJFrame for TruncatedPopupMenuTest.java
  • 2cd1ba6: 8324981: Shenandoah: Move commit and soft max heap changed methods into heap
  • 1733d2e: 8303374: Implement JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview)
  • 6697160: 8320712: Rewrite BadFactoryTest in pure Java
  • 725314f: 8324771: Obsolete RAMFraction related flags
  • ec6c35c: 8324970: Serial: Refactor signature of maintain_old_to_young_invariant
  • ... and 2 more: https://git.openjdk.org/jdk/compare/f7121de4a080c222e2bbf2468be94950db78530a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 1, 2024

@johnshajiang Pushed as commit fe78c0f.

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

@johnshajiang johnshajiang deleted the 8325022 branch February 1, 2024 02:36
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.

6 participants