From 48edf40861f72ba1c1712d45e4b4d410176d81f7 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 12 Apr 2019 21:36:57 +0200 Subject: [PATCH] Make validation tools more happy by not have TrustManager impl just accept (#9041) Motivation: Seems like some analyzer / validation tools scan code to detect if it may produce some security risk because of just blindly accept certificates. Such a tool did tag our code because we have such an implementation (which then is actually never be used). We should just change the impl to not do this as it does not matter for us and it makes such tools happier. Modifications: Throw CertificateException Result: Fixes https://github.com/netty/netty/issues/9032 --- .../io/netty/handler/ssl/OpenSslX509TrustManagerWrapper.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/handler/src/main/java/io/netty/handler/ssl/OpenSslX509TrustManagerWrapper.java b/handler/src/main/java/io/netty/handler/ssl/OpenSslX509TrustManagerWrapper.java index 0a0db0bbf4..a2b12becdb 100644 --- a/handler/src/main/java/io/netty/handler/ssl/OpenSslX509TrustManagerWrapper.java +++ b/handler/src/main/java/io/netty/handler/ssl/OpenSslX509TrustManagerWrapper.java @@ -71,11 +71,13 @@ final class OpenSslX509TrustManagerWrapper { @Override public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { + throw new CertificateException(); } @Override public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { + throw new CertificateException(); } @Override