yuqi1129 commented on code in PR #4337:
URL: https://github.com/apache/gravitino/pull/4337#discussion_r1701073221


##########
integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/CommandExecutor.java:
##########
@@ -47,10 +47,9 @@ public static Object executeCommandLocalHost(
       Map<String, String> env) {
     List<String> subCommandsAsList = new ArrayList<>(Arrays.asList(command));
     String mergedCommand = StringUtils.join(subCommandsAsList, " ");
-
     LOG.info("Sending command \"{}\" to localhost", mergedCommand);
 
-    ProcessBuilder processBuilder = new ProcessBuilder(command);
+    ProcessBuilder processBuilder = new ProcessBuilder(subCommandsAsList);

Review Comment:
   If the command is a string value, `ProcessBuilder` will take it as a whole 
command like `ls -al; rm -rf`, however, if we split it into a list, `-al;`, 
`rm`, `-rf` will be reviewed as the parameter of the first command `ls`, thus 
dangerous operations like `rm -rf` will not take effect.
   



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