fix(deploy): fix security
This commit is contained in:
@@ -92,8 +92,9 @@ public class SlicerService {
|
||||
// 3. Run slicer. Retry with arrange only for out-of-volume style failures.
|
||||
for (boolean useArrange : new boolean[]{false, true}) {
|
||||
// Build process arguments explicitly to avoid shell interpretation and command injection.
|
||||
ProcessBuilder pb = new ProcessBuilder(trustedSlicerPath);
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
List<String> command = pb.command();
|
||||
command.add(trustedSlicerPath);
|
||||
command.add("--load-settings");
|
||||
command.add(machineProfilePath);
|
||||
command.add("--load-settings");
|
||||
@@ -168,11 +169,11 @@ public class SlicerService {
|
||||
Path infoLogPath = tempDir.resolve("orcaslicer-info.log");
|
||||
String inputModelPath = requireSafeArgument(inputModel.getAbsolutePath(), "input model path");
|
||||
|
||||
ProcessBuilder pb = new ProcessBuilder(
|
||||
trustedSlicerPath,
|
||||
"--info",
|
||||
inputModelPath
|
||||
);
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
List<String> infoCommand = pb.command();
|
||||
infoCommand.add(trustedSlicerPath);
|
||||
infoCommand.add("--info");
|
||||
infoCommand.add(inputModelPath);
|
||||
pb.directory(tempDir.toFile());
|
||||
pb.redirectErrorStream(true);
|
||||
pb.redirectOutput(infoLogPath.toFile());
|
||||
|
||||
Reference in New Issue
Block a user