github-code-scanning[bot] commented on code in PR #3174:
URL: https://github.com/apache/calcite/pull/3174#discussion_r1174633639


##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.elasticsearch;
+
+import java.net.Socket;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.X509ExtendedTrustManager;
+
+/**
+ * This class is used to disable SSL Certificate Verification in 
ElasticSearch.  This trust
+ * manager will validate any SSL certificate, whether valid or not.
+ *
+ *
+ * <p>This should <b>not</b> be used in production environments.
+ * </p>
+ */
+public final class UnsafeX509ExtendedTrustManager extends 
X509ExtendedTrustManager {
+
+  /**
+   * Return a new instance of the unsafe, all-trusting trust manager.
+   */
+  static final X509ExtendedTrustManager INSTANCE = new 
UnsafeX509ExtendedTrustManager();
+  private static final X509Certificate[] EMPTY_CERTIFICATES = new 
X509Certificate[0];
+
+  private UnsafeX509ExtendedTrustManager() {}
+
+  public static X509ExtendedTrustManager getInstance() {
+    return INSTANCE;
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates, 
String authType) {

Review Comment:
   ## Server certificates should be verified during SSL/TLS connections
   
   <!--SONAR_ISSUE_KEY:AYevnJF5Hs0MTalI-jiR-->Enable server certificate 
validation on this SSL/TLS connection. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_calcite&issues=AYevnJF5Hs0MTalI-jiR&open=AYevnJF5Hs0MTalI-jiR&pullRequest=3174";>SonarCloud</a></p>
   
   [Show more 
details](https://github.com/apache/calcite/security/code-scanning/12)



##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.elasticsearch;
+
+import java.net.Socket;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.X509ExtendedTrustManager;
+
+/**
+ * This class is used to disable SSL Certificate Verification in 
ElasticSearch.  This trust
+ * manager will validate any SSL certificate, whether valid or not.
+ *
+ *
+ * <p>This should <b>not</b> be used in production environments.
+ * </p>
+ */
+public final class UnsafeX509ExtendedTrustManager extends 
X509ExtendedTrustManager {
+
+  /**
+   * Return a new instance of the unsafe, all-trusting trust manager.
+   */
+  static final X509ExtendedTrustManager INSTANCE = new 
UnsafeX509ExtendedTrustManager();
+  private static final X509Certificate[] EMPTY_CERTIFICATES = new 
X509Certificate[0];
+
+  private UnsafeX509ExtendedTrustManager() {}
+
+  public static X509ExtendedTrustManager getInstance() {
+    return INSTANCE;
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates, 
String authType) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,
+      String authType, Socket socket) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,
+      String authType, SSLEngine sslEngine) {
+    // No op
+  }
+
+  @Override public void checkServerTrusted(X509Certificate[] certificates, 
String authType) {
+    // No op
+  }
+
+  @Override public void checkServerTrusted(X509Certificate[] certificates,

Review Comment:
   ## Server certificates should be verified during SSL/TLS connections
   
   <!--SONAR_ISSUE_KEY:AYevpel6oMuZgdLV3OOz-->Enable server certificate 
validation on this SSL/TLS connection. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_calcite&issues=AYevpel6oMuZgdLV3OOz&open=AYevpel6oMuZgdLV3OOz&pullRequest=3174";>SonarCloud</a></p>
   
   [Show more 
details](https://github.com/apache/calcite/security/code-scanning/19)



##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.elasticsearch;
+
+import java.net.Socket;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.X509ExtendedTrustManager;
+
+/**
+ * This class is used to disable SSL Certificate Verification in 
ElasticSearch.  This trust
+ * manager will validate any SSL certificate, whether valid or not.
+ *
+ *
+ * <p>This should <b>not</b> be used in production environments.
+ * </p>
+ */
+public final class UnsafeX509ExtendedTrustManager extends 
X509ExtendedTrustManager {
+
+  /**
+   * Return a new instance of the unsafe, all-trusting trust manager.
+   */
+  static final X509ExtendedTrustManager INSTANCE = new 
UnsafeX509ExtendedTrustManager();
+  private static final X509Certificate[] EMPTY_CERTIFICATES = new 
X509Certificate[0];
+
+  private UnsafeX509ExtendedTrustManager() {}
+
+  public static X509ExtendedTrustManager getInstance() {
+    return INSTANCE;
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates, 
String authType) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,
+      String authType, Socket socket) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,

Review Comment:
   ## Server certificates should be verified during SSL/TLS connections
   
   <!--SONAR_ISSUE_KEY:AYevpel6oMuZgdLV3OOy-->Enable server certificate 
validation on this SSL/TLS connection. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_calcite&issues=AYevpel6oMuZgdLV3OOy&open=AYevpel6oMuZgdLV3OOy&pullRequest=3174";>SonarCloud</a></p>
   
   [Show more 
details](https://github.com/apache/calcite/security/code-scanning/18)



##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.elasticsearch;
+
+import java.net.Socket;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.X509ExtendedTrustManager;
+
+/**
+ * This class is used to disable SSL Certificate Verification in 
ElasticSearch.  This trust
+ * manager will validate any SSL certificate, whether valid or not.
+ *
+ *
+ * <p>This should <b>not</b> be used in production environments.
+ * </p>
+ */
+public final class UnsafeX509ExtendedTrustManager extends 
X509ExtendedTrustManager {
+
+  /**
+   * Return a new instance of the unsafe, all-trusting trust manager.
+   */
+  static final X509ExtendedTrustManager INSTANCE = new 
UnsafeX509ExtendedTrustManager();
+  private static final X509Certificate[] EMPTY_CERTIFICATES = new 
X509Certificate[0];
+
+  private UnsafeX509ExtendedTrustManager() {}
+
+  public static X509ExtendedTrustManager getInstance() {
+    return INSTANCE;
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates, 
String authType) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,
+      String authType, Socket socket) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,
+      String authType, SSLEngine sslEngine) {
+    // No op
+  }
+
+  @Override public void checkServerTrusted(X509Certificate[] certificates, 
String authType) {

Review Comment:
   ## Server certificates should be verified during SSL/TLS connections
   
   <!--SONAR_ISSUE_KEY:AYevnJF5Hs0MTalI-jiU-->Enable server certificate 
validation on this SSL/TLS connection. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_calcite&issues=AYevnJF5Hs0MTalI-jiU&open=AYevnJF5Hs0MTalI-jiU&pullRequest=3174";>SonarCloud</a></p>
   
   [Show more 
details](https://github.com/apache/calcite/security/code-scanning/15)



##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.elasticsearch;
+
+import java.net.Socket;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.X509ExtendedTrustManager;
+
+/**
+ * This class is used to disable SSL Certificate Verification in 
ElasticSearch.  This trust
+ * manager will validate any SSL certificate, whether valid or not.
+ *
+ *
+ * <p>This should <b>not</b> be used in production environments.
+ * </p>
+ */
+public final class UnsafeX509ExtendedTrustManager extends 
X509ExtendedTrustManager {
+
+  /**
+   * Return a new instance of the unsafe, all-trusting trust manager.
+   */
+  static final X509ExtendedTrustManager INSTANCE = new 
UnsafeX509ExtendedTrustManager();
+  private static final X509Certificate[] EMPTY_CERTIFICATES = new 
X509Certificate[0];
+
+  private UnsafeX509ExtendedTrustManager() {}
+
+  public static X509ExtendedTrustManager getInstance() {
+    return INSTANCE;
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates, 
String authType) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,
+      String authType, Socket socket) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,
+      String authType, SSLEngine sslEngine) {
+    // No op
+  }
+
+  @Override public void checkServerTrusted(X509Certificate[] certificates, 
String authType) {
+    // No op
+  }
+
+  @Override public void checkServerTrusted(X509Certificate[] certificates,
+      String authType, Socket socket) {
+    // No op
+  }
+
+  @Override public void checkServerTrusted(X509Certificate[] certificates,

Review Comment:
   ## Server certificates should be verified during SSL/TLS connections
   
   <!--SONAR_ISSUE_KEY:AYevpel6oMuZgdLV3OO0-->Enable server certificate 
validation on this SSL/TLS connection. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_calcite&issues=AYevpel6oMuZgdLV3OO0&open=AYevpel6oMuZgdLV3OO0&pullRequest=3174";>SonarCloud</a></p>
   
   [Show more 
details](https://github.com/apache/calcite/security/code-scanning/17)



##########
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/UnsafeX509ExtendedTrustManager.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.elasticsearch;
+
+import java.net.Socket;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.X509ExtendedTrustManager;
+
+/**
+ * This class is used to disable SSL Certificate Verification in 
ElasticSearch.  This trust
+ * manager will validate any SSL certificate, whether valid or not.
+ *
+ *
+ * <p>This should <b>not</b> be used in production environments.
+ * </p>
+ */
+public final class UnsafeX509ExtendedTrustManager extends 
X509ExtendedTrustManager {
+
+  /**
+   * Return a new instance of the unsafe, all-trusting trust manager.
+   */
+  static final X509ExtendedTrustManager INSTANCE = new 
UnsafeX509ExtendedTrustManager();
+  private static final X509Certificate[] EMPTY_CERTIFICATES = new 
X509Certificate[0];
+
+  private UnsafeX509ExtendedTrustManager() {}
+
+  public static X509ExtendedTrustManager getInstance() {
+    return INSTANCE;
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates, 
String authType) {
+    // No op
+  }
+
+  @Override public void checkClientTrusted(X509Certificate[] certificates,

Review Comment:
   ## Server certificates should be verified during SSL/TLS connections
   
   <!--SONAR_ISSUE_KEY:AYevnJF5Hs0MTalI-jiS-->Enable server certificate 
validation on this SSL/TLS connection. <p>See more on <a 
href="https://sonarcloud.io/project/issues?id=apache_calcite&issues=AYevnJF5Hs0MTalI-jiS&open=AYevnJF5Hs0MTalI-jiS&pullRequest=3174";>SonarCloud</a></p>
   
   [Show more 
details](https://github.com/apache/calcite/security/code-scanning/13)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to