From 07cb057fadfca7a277f8efa551cc6f0cfc9378e7 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 24 Apr 2024 16:50:23 +0300 Subject: [PATCH 1/2] add a warning and skip iteration if repository for SCA scan isn't found --- commands/audit/scarunner.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commands/audit/scarunner.go b/commands/audit/scarunner.go index 2472701c..a96a119e 100644 --- a/commands/audit/scarunner.go +++ b/commands/audit/scarunner.go @@ -72,6 +72,10 @@ func runScaScan(params *AuditParams, results *xrayutils.Results) (err error) { // Calculate the scans to preform func getScaScansToPreform(params *AuditParams) (scansToPreform []*xrayutils.ScaScanResult) { for _, requestedDirectory := range params.workingDirs { + if !fileutils.IsPathExists(requestedDirectory, false) { + log.Warn("The requested directory", requestedDirectory, "doesn't exist. SCA scan is skipped for this directory.") + continue + } // Detect descriptors and technologies in the requested directory. techToWorkingDirs, err := coreutils.DetectTechnologiesDescriptors(requestedDirectory, params.IsRecursiveScan(), params.Technologies(), getRequestedDescriptors(params), sca.GetExcludePattern(params.AuditBasicParams)) if err != nil { From dcd20511c55f4c736b511f2c1b6fa3a241b7ff3d Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Wed, 1 May 2024 14:46:44 +0300 Subject: [PATCH 2/2] fixed CR notes --- commands/audit/scarunner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/audit/scarunner.go b/commands/audit/scarunner.go index a96a119e..9b4d8870 100644 --- a/commands/audit/scarunner.go +++ b/commands/audit/scarunner.go @@ -73,7 +73,7 @@ func runScaScan(params *AuditParams, results *xrayutils.Results) (err error) { func getScaScansToPreform(params *AuditParams) (scansToPreform []*xrayutils.ScaScanResult) { for _, requestedDirectory := range params.workingDirs { if !fileutils.IsPathExists(requestedDirectory, false) { - log.Warn("The requested directory", requestedDirectory, "doesn't exist. SCA scan is skipped for this directory.") + log.Warn("The working directory", requestedDirectory, "doesn't exist. Skipping SCA scan...") continue } // Detect descriptors and technologies in the requested directory.