GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added host name identification algorithm to SslContextBuilder by ansip · Pull Request #12419 · netty/netty

Conversation

@ansip

@ansip ansip commented May 22, 2022

Copy link
Copy Markdown

Motivation:

To get rid of vulnerability and add proper hostname identification by default

Modification:

added parameter endpointIdentificationAlgorithm to SslContextBuilder and passed this to SslContext implementations

Result:

Fixes 8537.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ansip added 4 commits May 22, 2022 20:27
@ansip
added hostname identification after tls handshake
1f11b88
@ansip
Merge pull request #1 from ansip/feature/add-possibility-to-validate-…
7bf871e
…hostname-during-tls-hanshake

added hostname identification after tls handshake
@ansip
Feature/add possibility to validate hostname during tls hanshake (#2)
5f6a70f
* added hostname identification after tls handshake
@ansip
added hostname identification after tls handshake
08d9440
@ansip ansip changed the title Main Added host name identification algorithm to SslContextBuilder May 22, 2022
chrisvest
chrisvest reviewed May 23, 2022
View reviewed changes
Comment thread handler/src/main/java/io/netty5/handler/ssl/SslContextBuilder.java Outdated
} else {
String endpointIA = null;
if (!PlatformDependent.isAndroid() || PlatformDependent.androidApiVersion() >= 24) {
endpointIA = endpointIdentificationAlgorithm;

@chrisvest chrisvest May 23, 2022

Copy link
Copy Markdown
Member

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.

What happens on older Android if we passed an EIA value?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ansip ansip May 24, 2022

Copy link
Copy Markdown
Author

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 honest I haven't checked, but I think that something like NoSuchMethodError because this method was added since 24 version
https://developer.android.com/reference/javax/net/ssl/SSLParameters#setEndpointIdentificationAlgorithm(java.lang.String)

Maybe it is better to throw IllegalStateException from SslContextBuilder methods in this case

endpointIdentificationAlgorithm(String value){
  if(value != null && PlatformDependent.isAndroid() && PlatformDependent.androidApiVersion() < 24){
     throw new IllegalStateException(...);
  }
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@chrisvest chrisvest May 24, 2022

Copy link
Copy Markdown
Member

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.

Yeah, throwing IllegalStateException is better, since that will not leave a false impression that configuring this setting worked.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ansip ansip May 26, 2022

Copy link
Copy Markdown
Author

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chrisvest

chrisvest commented May 23, 2022

Copy link
Copy Markdown
Member

@ansip Please sign the ICLA as described on https://netty.io/wiki/developer-guide.html

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ansip

ansip commented May 24, 2022

Copy link
Copy Markdown
Author

@ansip Please sign the ICLA as described on https://netty.io/wiki/developer-guide.html

done

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest

chrisvest commented May 24, 2022

Copy link
Copy Markdown
Member

I don't fully get why, but there's a bunch of SSL related test failures.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ansip
added hostname identification after tls handshake
58274db
@ansip

ansip commented May 26, 2022

Copy link
Copy Markdown
Author

I don't fully get why, but there's a bunch of SSL related test failures.

The problem here is because endpoint identification algorithm is applicable only when you specified peerHost
hence it makes sense for newEngine(alloc, peerHost, peerPort) and newhandler(alloc, peerHost, peerPort) methods

otherwise it fails with NPE, this is a bit weird java security api, I would expect some meaningful error during SSLEngine construction...
anywat I've added additional checks to prevent NPE

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ansip
added hostname identification after tls handshake
93f3200
idelpivnitskiy
idelpivnitskiy reviewed Sep 14, 2022
View reviewed changes
Comment thread handler/src/main/java/io/netty5/handler/ssl/SslContextBuilder.java
* @see SslContext#newEngine(BufferAllocator, String, int)
* @see SslContext#newHandler(BufferAllocator, String, int)
*/
public SslContextBuilder hostNameIdentification(boolean enableHostNameIdentification) {

@idelpivnitskiy idelpivnitskiy Sep 14, 2022

Copy link
Copy Markdown
Member

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.

There is not much value in a separate builder method that takes a boolean. IIRC, "HTTPS" is enabled by default. Users who want to disable it, can pass an empty string to endpointIdentificationAlgorithm to disable it. Consider documenting this ability. Example:

  1. User config: https://github.com/apple/servicetalk/blob/bb0ed159d52aed38fff41bae5fd19d3b04f9473e/servicetalk-http-netty/src/test/java/io/servicetalk/http/netty/SslAndNonSslConnectionsTest.java#L187
  2. How we set it: https://github.com/apple/servicetalk/blob/50079f71d007d3c43b5152086f3844a3f56eac57/servicetalk-transport-netty-internal/src/main/java/io/servicetalk/transport/netty/internal/SslUtils.java#L66-L68

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ansip ansip Sep 16, 2022

Copy link
Copy Markdown
Author

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, makes sense, I just wanted to add shortcut because I suspect in most cases "HTTPS" method validation will be used (havent seen LDAPS usages so far)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@normanmaurer
normanmaurer force-pushed the main branch from 0538f48 to 44f69d4 Compare January 9, 2023 09:38
@normanmaurer
normanmaurer force-pushed the main branch from 585adf1 to fc4714b Compare January 26, 2023 09:35
@chrisvest

chrisvest commented Feb 26, 2025

Copy link
Copy Markdown
Member

We can close this PR, as this feature got implemented in #14174 instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisvest chrisvest closed this Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chrisvest chrisvest chrisvest left review comments
@idelpivnitskiy idelpivnitskiy idelpivnitskiy left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@ansip @chrisvest @idelpivnitskiy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.