Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ public String execKubectl(String args, Map<String, Object> manifest)
String json = manifestToJson(manifest);
ProcessBuilder builder = new ProcessBuilder();
List<String> cmd = new ArrayList<>();
cmd.add("sh");
cmd.add("-c");
cmd.add(KUBECTL_PATH + " --kubeconfig=" + KUBECFG_PATH + " " + args);
cmd.add(KUBECTL_PATH.toString());
cmd.add("--kubeconfig=" + KUBECFG_PATH.toString());
// Split args on whitespace and add each argument separately to avoid shell injection
if (args != null && !args.trim().isEmpty()) {
String[] argArray = args.trim().split("\\s+");
cmd.addAll(Arrays.asList(argArray));
}
builder.command(cmd);
builder.redirectErrorStream(true);
Process process = builder.start();
Expand Down Expand Up @@ -193,9 +197,12 @@ private void createCluster() throws IOException, InterruptedException {
private String runKindCmd(String args) throws IOException, InterruptedException {
ProcessBuilder builder = new ProcessBuilder();
List<String> cmd = new ArrayList<>();
cmd.add("sh");
cmd.add("-c");
cmd.add(Paths.get(IT_BUILD_HOME.toString(), "kind") + " " + args);
cmd.add(Paths.get(IT_BUILD_HOME.toString(), "kind").toString());
// Split args on whitespace and add each argument separately to avoid shell injection
if (args != null && !args.trim().isEmpty()) {
String[] argArray = args.trim().split("\\s+");
cmd.addAll(Arrays.asList(argArray));
}
builder.command(cmd);
builder.redirectErrorStream(true);
Process process = builder.start();
Expand Down
Loading