From cb3d3c3d0f5f48e50725039bfc03dc0d3161bd7d Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Mon, 29 Dec 2025 17:40:03 +0200 Subject: [PATCH 1/2] removing olf logic of only source results in PR scan --- scanpullrequest/scanpullrequest.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scanpullrequest/scanpullrequest.go b/scanpullrequest/scanpullrequest.go index 1282f37ce..6200c2cc0 100644 --- a/scanpullrequest/scanpullrequest.go +++ b/scanpullrequest/scanpullrequest.go @@ -170,15 +170,17 @@ func auditPullRequestSourceCode(repoConfig *utils.Repository, scanDetails *utils } // Set JAS output flags based on the scan results repoConfig.OutputWriter.SetJasOutputFlags(scanResults.EntitledForJas, scanResults.HasJasScansResults(jasutils.Applicability)) - workingDirs := []string{strings.TrimPrefix(sourceBranchWd, string(filepath.Separator))} - if targetBranchWd != "" && scanDetails.ResultsToCompare != nil { - log.Debug("Diff scan - converting to new issues...") - workingDirs = append(workingDirs, strings.TrimPrefix(targetBranchWd, string(filepath.Separator))) - } + if targetBranchWd == "" || scanDetails.ResultsToCompare == nil { + // Since we only perform a Diff scan in this flow - if target wd or target results are missing it means something went wrong with the target scan + issuesCollection = &issues.ScansIssuesCollection{ScanStatus: getResultScanStatues(scanResults)} + err = errors.New("targetBranchWd or target branch scans results are empty") + return + } filterFailedResultsIfScannersFailuresAreAllowed(scanDetails.ResultsToCompare, scanResults, repoConfig.Params.ConfigProfile.GeneralConfig.FailUponAnyScannerError, sourceBranchWd, targetBranchWd) - issuesCollection, e := scanResultsToIssuesCollection(scanResults, workingDirs...) + log.Debug("Diff scan - converting to new issues...") + issuesCollection, e := scanResultsToIssuesCollection(scanResults, strings.TrimPrefix(sourceBranchWd, string(filepath.Separator)), strings.TrimPrefix(targetBranchWd, string(filepath.Separator))) if e != nil { err = errors.Join(err, fmt.Errorf("failed to get issues for pull request. Error: %s", e.Error())) } From b7b6f9ca81acf620f221f5bf8b8a9bde3df30500 Mon Sep 17 00:00:00 2001 From: Eran Turgeman Date: Sun, 4 Jan 2026 11:21:48 +0200 Subject: [PATCH 2/2] remove redundant defensive check --- scanpullrequest/scanpullrequest.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scanpullrequest/scanpullrequest.go b/scanpullrequest/scanpullrequest.go index 6200c2cc0..e01f3b0c3 100644 --- a/scanpullrequest/scanpullrequest.go +++ b/scanpullrequest/scanpullrequest.go @@ -170,13 +170,6 @@ func auditPullRequestSourceCode(repoConfig *utils.Repository, scanDetails *utils } // Set JAS output flags based on the scan results repoConfig.OutputWriter.SetJasOutputFlags(scanResults.EntitledForJas, scanResults.HasJasScansResults(jasutils.Applicability)) - - if targetBranchWd == "" || scanDetails.ResultsToCompare == nil { - // Since we only perform a Diff scan in this flow - if target wd or target results are missing it means something went wrong with the target scan - issuesCollection = &issues.ScansIssuesCollection{ScanStatus: getResultScanStatues(scanResults)} - err = errors.New("targetBranchWd or target branch scans results are empty") - return - } filterFailedResultsIfScannersFailuresAreAllowed(scanDetails.ResultsToCompare, scanResults, repoConfig.Params.ConfigProfile.GeneralConfig.FailUponAnyScannerError, sourceBranchWd, targetBranchWd) log.Debug("Diff scan - converting to new issues...")