From b2d5fd2a00846424bc293f475fa3b3a7231cc45d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 07:29:04 +0000 Subject: [PATCH] Fix command injection vulnerability in dockerPrune Replaced `/bin/bash -c "docker system prune -f 2>&1"` with direct `Foundation.Process` instantiation using `["docker", "system", "prune", "-f"]`. This removes the reliance on shell string interpolation and prevents any potential command injection risks if the arguments were to become dynamic. Co-authored-by: acebytes <2820910+acebytes@users.noreply.github.com> --- Sources/Cacheout/ViewModels/CacheoutViewModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Cacheout/ViewModels/CacheoutViewModel.swift b/Sources/Cacheout/ViewModels/CacheoutViewModel.swift index 13a9811..e50a217 100644 --- a/Sources/Cacheout/ViewModels/CacheoutViewModel.swift +++ b/Sources/Cacheout/ViewModels/CacheoutViewModel.swift @@ -231,8 +231,8 @@ class CacheoutViewModel: ObservableObject { let process = Process() let pipe = Pipe() - process.executableURL = URL(fileURLWithPath: "/bin/bash") - process.arguments = ["-c", "docker system prune -f 2>&1"] + process.executableURL = URL(fileURLWithPath: "/usr/bin/env") + process.arguments = ["docker", "system", "prune", "-f"] process.standardOutput = pipe process.standardError = pipe process.environment = [