fix(deploy): fix security
Some checks failed
PR Checks / security-sast (pull_request) Failing after 29s
PR Checks / test-backend (pull_request) Successful in 38s
PR Checks / prettier-autofix (pull_request) Successful in 7s

This commit is contained in:
2026-03-03 13:12:27 +01:00
parent 958ec82ec1
commit a4c26ec912

View File

@@ -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());