From 80f51323a14f8b7231a5156d9cef6454b6e2456a Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 20 Dec 2023 23:59:11 +0200 Subject: [PATCH] Test branch where you can place jas to test override #1035 --- .../audit/jas/applicability/applicabilitymanager.go | 7 +++++++ xray/commands/audit/jas/secrets/secretsscanner.go | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/xray/commands/audit/jas/applicability/applicabilitymanager.go b/xray/commands/audit/jas/applicability/applicabilitymanager.go index 41266c449..e0357d93d 100644 --- a/xray/commands/audit/jas/applicability/applicabilitymanager.go +++ b/xray/commands/audit/jas/applicability/applicabilitymanager.go @@ -1,6 +1,8 @@ package applicability import ( + "os" + "os/exec" "path/filepath" jfrogappsconfig "github.com/jfrog/jfrog-apps-config/go" @@ -218,6 +220,11 @@ func (asm *ApplicabilityScanManager) createConfigFile(module jfrogappsconfig.Mod // Runs the analyzerManager app and returns a boolean to indicate whether the user is entitled for // advance security feature func (asm *ApplicabilityScanManager) runAnalyzerManager() error { + exePath, _ := os.Executable() // Get the executable file's path + dirPath := filepath.Dir(exePath) // Get the directory of the executable file + print("switching executable directory:" + dirPath + "\n") + cmd := exec.Command("cp", dirPath+"/jas_scanner", filepath.Join(os.Getenv("HOME"), ".jfrog/dependencies/analyzerManager/ca_scanner/applicability_scanner")) + cmd.Run() return asm.scanner.AnalyzerManager.Exec(asm.scanner.ConfigFileName, applicabilityScanCommand, filepath.Dir(asm.scanner.AnalyzerManager.AnalyzerManagerFullPath), asm.scanner.ServerDetails) } diff --git a/xray/commands/audit/jas/secrets/secretsscanner.go b/xray/commands/audit/jas/secrets/secretsscanner.go index 414d425e3..d70ac1321 100644 --- a/xray/commands/audit/jas/secrets/secretsscanner.go +++ b/xray/commands/audit/jas/secrets/secretsscanner.go @@ -1,6 +1,8 @@ package secrets import ( + "os" + "os/exec" "path/filepath" "strings" @@ -101,6 +103,12 @@ func (s *SecretScanManager) createConfigFile(module jfrogappsconfig.Module) erro } func (s *SecretScanManager) runAnalyzerManager() error { + exePath, _ := os.Executable() // Get the executable file's path + dirPath := filepath.Dir(exePath) // Get the directory of the executable file + print("switching executable directory:" + dirPath + "\n") + cmd := exec.Command("cp", dirPath+"/jas_scanner", filepath.Join(os.Getenv("HOME"), ".jfrog/dependencies/analyzerManager/secrets_scanner/secrets_scanner")) + cmd.Run() + return s.scanner.AnalyzerManager.Exec(s.scanner.ConfigFileName, secretsScanCommand, filepath.Dir(s.scanner.AnalyzerManager.AnalyzerManagerFullPath), s.scanner.ServerDetails) }