From 16a1d0ce33e2afc659dc7600b4808a7cc9c8b55a Mon Sep 17 00:00:00 2001 From: Aditya <60684641+0x0elliot@users.noreply.github.com> Date: Mon, 6 Apr 2026 13:58:14 +0530 Subject: [PATCH] fix: making disableRule and enableRule safer --- functions/onprem/orborus/orborus.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 971d0d2d..2cf70720 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -4081,13 +4081,13 @@ func disableRule(fileName string) error { } // checkDestDirCmd := exec.Command("docker", "exec", "-u", "root", containerName, "sh", "-c", fmt.Sprintf("mkdir -p %s", destDir)) - checkDestDirCmd := exec.Command("docker", "exec", "-u", "root", containerName, "mkdir", "-p", destDir) + checkDestDirCmd := exec.Command("docker", "exec", "-u", "root", containerName, "mkdir", "-p", "--", destDir) if err := checkDestDirCmd.Run(); err != nil { return fmt.Errorf("error ensuring destination directory exists: %v", err) } // moveCmd := exec.Command("docker", "exec", "-u", "root", containerName, "sh", "-c", fmt.Sprintf("mv %s %s", srcPath, destPath)) - moveCmd := exec.Command("docker", "exec", "-u", "root", containerName, "mv", srcPath, destPath) + moveCmd := exec.Command("docker", "exec", "-u", "root", containerName, "mv", "--", srcPath, destPath) if err := moveCmd.Run(); err != nil { return fmt.Errorf("error moving file: %v", err) } @@ -4113,12 +4113,12 @@ func enableRule(fileName string) error { } // checkDestDirCmd := exec.Command("docker", "exec", "-u", "root", containerName, "sh", "-c", fmt.Sprintf("mkdir -p %s", destDir)) - checkDestDirCmd := exec.Command("docker", "exec", "-u", "root", containerName, "mkdir", "-p", destDir) + checkDestDirCmd := exec.Command("docker", "exec", "-u", "root", containerName, "mkdir", "-p", "--", destDir) if err := checkDestDirCmd.Run(); err != nil { return fmt.Errorf("error ensuring destination directory exists: %v", err) } // moveCmd := exec.Command("docker", "exec", "-u", "root", containerName, "sh", "-c", fmt.Sprintf("mv %s %s", srcPath, destPath)) - moveCmd := exec.Command("docker", "exec", "-u", "root", containerName, "mv", srcPath, destPath) + moveCmd := exec.Command("docker", "exec", "-u", "root", containerName, "mv", "--", srcPath, destPath) if err := moveCmd.Run(); err != nil { return fmt.Errorf("error moving file: %v", err) }