github-advanced-security[bot] commented on code in PR #19037:
URL: https://github.com/apache/druid/pull/19037#discussion_r2833669747


##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/auth/EmbeddedSSLAuthResource.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.druid.testing.embedded.auth;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.druid.https.SSLContextModule;
+import org.apache.druid.java.util.common.ISE;
+import org.apache.druid.testing.embedded.EmbeddedDruidCluster;
+import org.apache.druid.testing.embedded.EmbeddedResource;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * {@link EmbeddedResource} used to enable SSL on Druid services.
+ * This resource generates the certificates and keystores needed by both the
+ * server and client, and then configures the Druid cluster with the 
appropriate
+ * keystore and truststore paths.
+ */
+public class EmbeddedSSLAuthResource implements EmbeddedResource
+{
+  private EmbeddedDruidCluster cluster;
+
+  @Override
+  public void beforeStart(EmbeddedDruidCluster cluster)
+  {
+    this.cluster = cluster;
+  }
+
+  @Override
+  public void start() throws Exception
+  {
+    final File tlsDir = getTlsTempDirectory();
+
+    final File tlsScripts = new File(tlsDir, "scripts");
+    copyScriptsToDirectory(tlsScripts);
+
+    // Generate client certificates and keystores
+    final ProcessBuilder generateClientCertificates = new ProcessBuilder(
+        "bash",
+        new File(tlsScripts, 
"generate-client-certs-and-keystores.sh").getAbsolutePath()
+    );
+    generateClientCertificates.directory(tlsDir);
+    generateClientCertificates.redirectErrorStream(true);
+    generateClientCertificates.redirectOutput(ProcessBuilder.Redirect.INHERIT);
+
+    int exitCode = generateClientCertificates.start().waitFor();
+    if (exitCode != 0) {
+      throw new ISE("Client certificate generation failed");
+    }
+
+    // Generate server certificates and keystores
+    final ProcessBuilder generateServerCertificates = new ProcessBuilder(
+        "bash",

Review Comment:
   ## Executing a command with a relative path
   
   Command with a relative path 'bash' is executed.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10820)



##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/auth/EmbeddedSSLAuthResource.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.druid.testing.embedded.auth;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.druid.https.SSLContextModule;
+import org.apache.druid.java.util.common.ISE;
+import org.apache.druid.testing.embedded.EmbeddedDruidCluster;
+import org.apache.druid.testing.embedded.EmbeddedResource;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * {@link EmbeddedResource} used to enable SSL on Druid services.
+ * This resource generates the certificates and keystores needed by both the
+ * server and client, and then configures the Druid cluster with the 
appropriate
+ * keystore and truststore paths.
+ */
+public class EmbeddedSSLAuthResource implements EmbeddedResource
+{
+  private EmbeddedDruidCluster cluster;
+
+  @Override
+  public void beforeStart(EmbeddedDruidCluster cluster)
+  {
+    this.cluster = cluster;
+  }
+
+  @Override
+  public void start() throws Exception
+  {
+    final File tlsDir = getTlsTempDirectory();
+
+    final File tlsScripts = new File(tlsDir, "scripts");
+    copyScriptsToDirectory(tlsScripts);
+
+    // Generate client certificates and keystores
+    final ProcessBuilder generateClientCertificates = new ProcessBuilder(
+        "bash",

Review Comment:
   ## Executing a command with a relative path
   
   Command with a relative path 'bash' is executed.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/10819)



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to