You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/01/07 21:43:21 UTC

[httpcomponents-client] branch 4.5.x updated: DefaultHostnameVerifier: Match DNS and CN names against ICANN domains

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch 4.5.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git


The following commit(s) were added to refs/heads/4.5.x by this push:
     new e0416f0  DefaultHostnameVerifier: Match DNS and CN names against ICANN domains
e0416f0 is described below

commit e0416f07c344929699a2bc303eb3a049c62bd979
Author: Ryan Schmitt <rs...@apache.org>
AuthorDate: Mon Jan 6 15:57:06 2020 -0800

    DefaultHostnameVerifier: Match DNS and CN names against ICANN domains
    
    This change ensures that during hostname verification the public suffix
    list is only used to prevent wildcard matching against entire TLDs (e.g.
    `*.com`). Currently, private domains are also being matched against,
    which is preventing reasonable wildcards (such as
    `*.s3.eu-central-1.amazonaws.com`) from being respected.
---
 .../main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java
index cff6f95..fae1586 100644
--- a/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java
+++ b/httpclient/src/main/java/org/apache/http/conn/ssl/DefaultHostnameVerifier.java
@@ -169,7 +169,7 @@ public final class DefaultHostnameVerifier implements HostnameVerifier {
             final SubjectName subjectAlt = subjectAlts.get(i);
             if (subjectAlt.getType() == SubjectName.DNS) {
                 final String normalizedSubjectAlt = subjectAlt.getValue().toLowerCase(Locale.ROOT);
-                if (matchIdentityStrict(normalizedHost, normalizedSubjectAlt, publicSuffixMatcher)) {
+                if (matchIdentityStrict(normalizedHost, normalizedSubjectAlt, publicSuffixMatcher, DomainType.ICANN)) {
                     return;
                 }
             }
@@ -182,7 +182,7 @@ public final class DefaultHostnameVerifier implements HostnameVerifier {
                  final PublicSuffixMatcher publicSuffixMatcher) throws SSLException {
         final String normalizedHost = host.toLowerCase(Locale.ROOT);
         final String normalizedCn = cn.toLowerCase(Locale.ROOT);
-        if (!matchIdentityStrict(normalizedHost, normalizedCn, publicSuffixMatcher)) {
+        if (!matchIdentityStrict(normalizedHost, normalizedCn, publicSuffixMatcher, DomainType.ICANN)) {
             throw new SSLPeerUnverifiedException("Certificate for <" + host + "> doesn't match " +
                     "common name of the certificate subject: " + cn);
         }