8378500: Restrict IP literals from being allowed in javax.net.ssl.SNIHostName#30747
8378500: Restrict IP literals from being allowed in javax.net.ssl.SNIHostName#30747vy wants to merge 2 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back vyazici! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
Webrevs
|
|
/csr |
|
I've added the "csr" label as I think (and correct me if I have this wrong) that javax.net.ssl.SNIHostName can now fail for cases that it didn't previously fail. |
|
@AlanBateman has indicated that a compatibility and specification (CSR) request is needed for this pull request. @vy please create a CSR request for issue JDK-8378500 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
|
Yes - a CSR is needed for this change. Thanks for adding the label @AlanBateman. |
|
We've decided to leave |
|
In b2c40b2,
An alternative direction could be making the new Note that this is a draft to have a feeling on the end result — @AlanBateman, @dfuch, @djelinski, would you mind reviewing these changes, please? How shall I proceed? |
| * | ||
| * Users are advised to prefer the {@link #ofString(String) ofString()} | ||
| * static factory method over this constructor, since the former performs | ||
| * stricter checks. |
There was a problem hiding this comment.
I don't know if this will be seen, which makes me wonder if this should go a step further and deprecate the constructors.
There was a problem hiding this comment.
I'm glad you said this, I completely agree with your concern and reasoning. I will do it.
Though this reminded me another question I need some help with: Shall I migrate existing usages of SNIHostName::new to the new static factory methods in this PR? Slim PRs are ideal, but leaving the correction of call-sites to a 2nd PR bears the risk that we might end up having a 3rd PR if the 1st (this) one has any problems.
There was a problem hiding this comment.
There may be compatibility issues with change the existing usages (as they might fail with IAE) so I would keep that separate.
| * @spec https://www.rfc-editor.org/info/rfc6066 | ||
| * RFC 6066: Transport Layer Security (TLS) Extensions: Extension Definitions | ||
| */ | ||
| public static SNIHostName ofString(String hostname) { |
There was a problem hiding this comment.
ofHostName(String) and ofEncoded(byte) is another choice that would make it clear at the use sites.
There was a problem hiding this comment.
I had considered how it would look like at the call-site:
SNIHostName.ofHostName(hostName); // Too verbose/noisy with repetition?
and then thought of:
SNIHostName.ofString(hostName);
SNIHostName.ofBytes(hostName);
But I will leave the decision on naming to those more experienced in this field.
There was a problem hiding this comment.
SNIHostName.of(String) and SNIHostName.ofEncoded(byte[]) are other candidates.
| * <li>It is empty | ||
| * <li>It ends with a trailing dot | ||
| * <li>It is not a valid Internationalized Domain Name (IDN)</li> | ||
| * |
There was a problem hiding this comment.
This list seems to imply that an SNI hostname must be an IDN. I wonder if it might be better to first state what a valid SNI hostname is (ie a DNS hostname), mentioning IDNs and then later specify the exclusions, including (I presume) a string that starts with "xn--" but which doesn't represent a valid IDN?
Per RFC 6066 "3. Server Name Indication", disallow IP literals in
SNIHostName::new.While the following two call-sites could be simplified by removing IP literal checks, I've refrained from doing so because delegating some of the checks to an exception catching mechanism would impact the performance:
Progress
Issues
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30747/head:pull/30747$ git checkout pull/30747Update a local copy of the PR:
$ git checkout pull/30747$ git pull https://git.openjdk.org/jdk.git pull/30747/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30747View PR using the GUI difftool:
$ git pr show -t 30747Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30747.diff
Using Webrev
Link to Webrev Comment