Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Xray Source Control Service #896

Closed
wants to merge 99 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
5c110c7
add new attributes to technologiesData
EyalDelarea Feb 23, 2023
9dc0c98
add installation command to poetry package manager
EyalDelarea Feb 23, 2023
cc80c8a
add packageVersionOperator command to poetry package manager
EyalDelarea Feb 23, 2023
4c3dd20
Merge branch 'master' of https://github.com/jfrog/jfrog-cli-core
EyalDelarea Mar 5, 2023
813c79a
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli-core
EyalDelarea Mar 7, 2023
6ad8772
Merge branch 'master' of https://github.com/jfrog/jfrog-cli-core
EyalDelarea Mar 18, 2023
4d20901
Upgrade jfrog-cli-core to 2.31.1 (#739)
omerzi Apr 5, 2023
9b4006e
Added the Frogbot badge to the README (#745)
eyalbe4 Apr 13, 2023
1381a8b
Merge remote-tracking branch 'upstream/dev' into mastercore
sverdlov93 Apr 19, 2023
f8e3a22
Merge remote-tracking branch 'upstream/dev' into mastercore
sverdlov93 Apr 19, 2023
4f7259c
Merge remote-tracking branch 'origin/dev'
omerzi May 2, 2023
932793d
Merge remote-tracking branch 'origin/dev'
omerzi May 3, 2023
2ddeac0
Merge branch 'dev'
eyalbe4 May 16, 2023
11ce1e8
Merge branch 'dev' into master
talarian1 May 17, 2023
521d832
Merge branch 'dev'
talarian1 May 17, 2023
f470da2
Merge remote-tracking branch 'origin/dev'
talarian1 May 17, 2023
2c85766
Merge remote-tracking branch 'origin/dev'
omerzi May 21, 2023
ae0b91d
Merge remote-tracking branch 'origin/dev'
talarian1 May 23, 2023
5a53932
Merge remote-tracking branch 'upstream/dev'
yahavi May 23, 2023
c07d9fb
Merge remote-tracking branch 'upstream/dev'
yahavi May 23, 2023
7040b6a
Merge remote-tracking branch 'origin/dev'
talarian1 May 24, 2023
e91d430
Merge branch 'dev'
eyalbe4 May 26, 2023
2680fdb
Upgrade jfrog-cli-core to 2.34.6
talarian1 May 28, 2023
b4ddac8
Merge branch 'master' into dev
eyalbe4 May 31, 2023
6dca5e7
Merge branch 'dev'
eyalbe4 May 31, 2023
9fa7b09
Merge remote-tracking branch 'origin/dev'
talarian1 May 31, 2023
a46fb01
Merge branch 'dev'
yahavi Jun 1, 2023
94469f4
Merge branch 'dev'
eyalbe4 Jun 4, 2023
b330d82
Merge branch 'dev'
eyalbe4 Jun 10, 2023
7141b4c
Merge branch 'master' into dev
omerzi Jun 27, 2023
ec17933
Merge branch 'dev'
eyalbe4 Jun 27, 2023
83ced5a
Merge branch 'dev'
RobiNino Jun 29, 2023
9e57a49
Merge branch 'dev'
yahavi Jul 4, 2023
fe4c82a
Merge branch 'master' into dev
omerzi Jul 12, 2023
47a0f3f
Upgrade jfrog-cli-core to 2.38.0
omerzi Jul 12, 2023
40e7d2d
Remove Secrets Scanner Sacanners Names config (#862)
talarian1 Jul 16, 2023
0be3aae
Upgrade jfrog-cli-core to 2.39.0
omerzi Jul 18, 2023
0a4b112
Merge remote-tracking branch 'origin/dev'
omerzi Jul 19, 2023
64ee611
Merge remote-tracking branch 'origin/dev'
omerzi Jul 19, 2023
d32579e
Merge remote-tracking branch 'origin/dev'
omerzi Jul 23, 2023
f79600c
Merge branch 'dev'
eyalbe4 Jul 31, 2023
db385fe
Merge branch 'dev'
eyalbe4 Aug 3, 2023
8e0ea69
Merge branch 'master' of https://github.com/jfrog/jfrog-cli-core
EyalDelarea Aug 15, 2023
203a303
Refactor to interface
EyalDelarea Aug 15, 2023
0a4c6dd
Split scan service
EyalDelarea Aug 15, 2023
a3860cf
Pull dev
EyalDelarea Aug 16, 2023
c35658f
Working XSC call
EyalDelarea Aug 16, 2023
c9a6c6d
Check XSC
EyalDelarea Aug 16, 2023
26665de
Check XSC
EyalDelarea Aug 16, 2023
33c5f6a
fix multi-scan-id
EyalDelarea Aug 16, 2023
ad71ffa
Fix code analysis errors
EyalDelarea Aug 16, 2023
177bf7b
remove testings object
EyalDelarea Aug 16, 2023
76eae4b
fix always using xsc
EyalDelarea Aug 17, 2023
fd6d7d2
fix static check
EyalDelarea Aug 17, 2023
c845f56
update go.mod
EyalDelarea Aug 17, 2023
f537f57
Fix choose XSC server when enabled
EyalDelarea Aug 17, 2023
3f8ba64
Handle XSC/XRAY url provided from flags and config.
EyalDelarea Aug 17, 2023
2703ea9
update go.mod
EyalDelarea Aug 17, 2023
15b1b89
Refactor
EyalDelarea Aug 17, 2023
7f03d26
Set tech after detection
EyalDelarea Aug 20, 2023
54e9636
pull dev
EyalDelarea Aug 20, 2023
7f29321
Update deps
EyalDelarea Aug 21, 2023
da848fe
update deps
EyalDelarea Aug 21, 2023
1c5b610
pull dev
EyalDelarea Aug 22, 2023
c06269d
move xsc endpoint const
EyalDelarea Aug 22, 2023
6e5b7f7
pull dev
EyalDelarea Aug 23, 2023
764490c
Update deps
EyalDelarea Aug 23, 2023
40a7068
Merge remote-tracking branch 'upstream/dev' into xsc
EyalDelarea Aug 24, 2023
8aa7d33
merge
EyalDelarea Aug 24, 2023
2dcae54
pass multi scan id as extra arg
EyalDelarea Aug 27, 2023
74017fb
Merge remote-tracking branch 'upstream/dev' into xsc
EyalDelarea Aug 27, 2023
35af079
pull dev
EyalDelarea Aug 27, 2023
a2e0bec
fix new arg
EyalDelarea Aug 27, 2023
f524051
pull dev
EyalDelarea Aug 28, 2023
e1ab392
pull dev
EyalDelarea Aug 29, 2023
64b367d
update deps
EyalDelarea Aug 29, 2023
196ae26
Remove testings code, add flag to provide multi scan id
EyalDelarea Aug 30, 2023
15d7d74
pull dev
EyalDelarea Aug 31, 2023
d476255
pass multi-scan-id
EyalDelarea Aug 31, 2023
7a49915
remove print
EyalDelarea Aug 31, 2023
5dcc2fa
update deps and log for debugging
EyalDelarea Aug 31, 2023
df51758
merge dev
EyalDelarea Sep 3, 2023
ccb508c
Add debug logs
EyalDelarea Sep 3, 2023
688e693
pull dev
EyalDelarea Sep 4, 2023
623cdbd
fix MSI flag
EyalDelarea Sep 4, 2023
2f79c0d
pull dev
EyalDelarea Sep 5, 2023
570d81c
fix pull dev
EyalDelarea Sep 5, 2023
5f3ac87
add xsc min version
EyalDelarea Sep 5, 2023
a9521b4
pull dev
EyalDelarea Sep 6, 2023
8455ea2
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli-core into xsc
EyalDelarea Sep 6, 2023
80f33a6
update jfrog-client-go
EyalDelarea Sep 6, 2023
6ed3b67
refactor
EyalDelarea Sep 7, 2023
9c23e7a
Fix comments and remove TODO
EyalDelarea Sep 7, 2023
8215745
pull client
EyalDelarea Sep 8, 2023
74ff464
pull dev
EyalDelarea Sep 8, 2023
1a8083e
update deps
EyalDelarea Sep 8, 2023
fd3454b
CR
EyalDelarea Sep 10, 2023
e3e3e88
update deps
EyalDelarea Sep 10, 2023
ce13fce
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli-core into xsc
EyalDelarea Sep 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
)

replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20230831152946-6ed2ae1aa57f
replace github.com/jfrog/jfrog-client-go => github.com/eyaldelarea/jfrog-client-go v1.28.4-0.20230910073131-584f26453ae8

replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20230905120411-62d1bdd4eb38

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/eyaldelarea/jfrog-client-go v1.28.4-0.20230910073131-584f26453ae8 h1:EWefxAImHHlUbTUtbXc6jjKRiFv5X+r/OdwEaxdB7rU=
github.com/eyaldelarea/jfrog-client-go v1.28.4-0.20230910073131-584f26453ae8/go.mod h1:soD5VL3X+G+0KKUNSlb0CSdF9nwHsQZCr0xqOGedAHM=
github.com/forPelevin/gomoji v1.1.8 h1:JElzDdt0TyiUlecy6PfITDL6eGvIaxqYH1V52zrd0qQ=
github.com/forPelevin/gomoji v1.1.8/go.mod h1:8+Z3KNGkdslmeGZBC3tCrwMrcPy5GRzAD+gL9NAwMXg=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
Expand Down Expand Up @@ -198,8 +200,6 @@ github.com/jfrog/build-info-go v1.8.9-0.20230905120411-62d1bdd4eb38 h1:XyAcwWP2a
github.com/jfrog/build-info-go v1.8.9-0.20230905120411-62d1bdd4eb38/go.mod h1:QEskae5fQpjeY2PBzsjWtUQVskYSNDF2sSmw/Gx44dQ=
github.com/jfrog/gofrog v1.3.0 h1:o4zgsBZE4QyDbz2M7D4K6fXPTBJht+8lE87mS9bw7Gk=
github.com/jfrog/gofrog v1.3.0/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230831152946-6ed2ae1aa57f h1:S6l0o2sKFLRJ+QYVB5U/PJhrnwFSmKFFY7eHpRPRH8A=
github.com/jfrog/jfrog-client-go v1.28.1-0.20230831152946-6ed2ae1aa57f/go.mod h1:uUnMrqHX7Xi+OCaZEE4b3BtsmGeOSCB7XqaEWVXEH/E=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
Expand Down
4 changes: 4 additions & 0 deletions utils/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ func (o *ConfigV0) Convert() *ConfigV4 {

type ServerDetails struct {
Url string `json:"url,omitempty"`
XscUrl string `json:"-"`
XscVersion string `json:"-"`
SshUrl string `json:"-"`
ArtifactoryUrl string `json:"artifactoryUrl,omitempty"`
DistributionUrl string `json:"distributionUrl,omitempty"`
Expand Down Expand Up @@ -703,6 +705,8 @@ func (serverDetails *ServerDetails) CreateDistAuthConfig() (auth.ServiceDetails,

func (serverDetails *ServerDetails) CreateXrayAuthConfig() (auth.ServiceDetails, error) {
artAuth := xrayAuth.NewXrayDetails()
artAuth.SetXscUrl(serverDetails.XscUrl)
artAuth.SetXscVersion(serverDetails.XscVersion)
artAuth.SetUrl(serverDetails.XrayUrl)
return serverDetails.createAuthConfig(artAuth)
}
Expand Down
2 changes: 1 addition & 1 deletion utils/usage/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (ur *UsageReporter) reportToXray(features ...ReportFeature) (err error) {
err = errorutils.CheckErrorf("Nothing to send.")
return
}
return xrayusage.SendXrayUsageEvents(*serviceManager, events...)
return xrayusage.SendXrayUsageEvents(serviceManager, events...)
}

func (ur *UsageReporter) reportToArtifactory(features ...ReportFeature) (err error) {
Expand Down
11 changes: 7 additions & 4 deletions xray/commands/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/jfrog/jfrog-cli-core/v2/xray/scangraph"
clientutils "github.com/jfrog/jfrog-client-go/utils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray"
"github.com/jfrog/jfrog-client-go/xray/services"
"golang.org/x/sync/errgroup"
"os"
Expand Down Expand Up @@ -157,14 +156,18 @@ func RunAudit(auditParams *AuditParams) (results *Results, err error) {
if err != nil {
return
}
var xrayManager *xray.XrayServicesManager
var xrayManager services.SecurityServiceManager
xrayManager, auditParams.xrayVersion, err = xrayutils.CreateXrayServiceManagerAndGetVersion(serverDetails)
if err != nil {
return
}
if err = clientutils.ValidateMinimumVersion(clientutils.Xray, auditParams.xrayVersion, scangraph.GraphScanMinXrayVersion); err != nil {
return
}
if auditParams.xscVersion, err = xrayManager.IsXscEnabled(); err != nil {
return
}

results.ExtendedScanResults.EntitledForJas, err = isEntitledForJas(xrayManager, auditParams.xrayVersion)
if err != nil {
return
Expand All @@ -186,12 +189,12 @@ func RunAudit(auditParams *AuditParams) (results *Results, err error) {

// Run scanners only if the user is entitled for Advanced Security
if results.ExtendedScanResults.EntitledForJas {
results.JasError = runJasScannersAndSetResults(results.ExtendedScanResults, auditParams.DirectDependencies(), serverDetails, auditParams.workingDirs, auditParams.Progress())
results.JasError = runJasScannersAndSetResults(results.ExtendedScanResults, auditParams.DirectDependencies(), serverDetails, auditParams.workingDirs, auditParams.Progress(), auditParams.xrayGraphScanParams.MultiScanId)
}
return
}

func isEntitledForJas(xrayManager *xray.XrayServicesManager, xrayVersion string) (entitled bool, err error) {
func isEntitledForJas(xrayManager services.SecurityServiceManager, xrayVersion string) (entitled bool, err error) {
if e := clientutils.ValidateMinimumVersion(clientutils.Xray, xrayVersion, xrayutils.EntitlementsMinVersion); e != nil {
log.Debug(e)
return
Expand Down
1 change: 1 addition & 0 deletions xray/commands/audit/auditparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type AuditParams struct {
minSeverityFilter string
*xrayutils.AuditBasicParams
xrayVersion string
xscVersion string
}

func NewAuditParams() *AuditParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package applicability

import (
"github.com/jfrog/jfrog-cli-core/v2/xray/commands/audit/jas"
"github.com/jfrog/jfrog-client-go/xray/services"
"path/filepath"
"strings"

Expand All @@ -10,7 +11,6 @@ import (
"github.com/jfrog/jfrog-cli-core/v2/xray/utils"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray/services"
"github.com/owenrumney/go-sarif/v2/sarif"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
Expand Down
5 changes: 3 additions & 2 deletions xray/commands/audit/jas/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type JasScanner struct {
ScannerDirCleanupFunc func() error
}

func NewJasScanner(workingDirs []string, serverDetails *config.ServerDetails) (scanner *JasScanner, err error) {
func NewJasScanner(workingDirs []string, serverDetails *config.ServerDetails, multiScanId string) (scanner *JasScanner, err error) {
scanner = &JasScanner{}
if scanner.AnalyzerManager.AnalyzerManagerFullPath, err = utils.GetAnalyzerManagerExecutable(); err != nil {
return
Expand All @@ -47,6 +47,7 @@ func NewJasScanner(workingDirs []string, serverDetails *config.ServerDetails) (s
scanner.ConfigFileName = filepath.Join(tempDir, "config.yaml")
scanner.ResultsFileName = filepath.Join(tempDir, "results.sarif")
scanner.WorkingDirs, err = coreutils.GetFullPathsWorkingDirs(workingDirs)
scanner.AnalyzerManager.MultiScanId = multiScanId
return
}

Expand Down Expand Up @@ -170,7 +171,7 @@ var FakeBasicXrayResults = []services.ScanResponse{

func InitJasTest(t *testing.T, workingDirs ...string) (*JasScanner, func()) {
assert.NoError(t, rtutils.DownloadAnalyzerManagerIfNeeded())
scanner, err := NewJasScanner(workingDirs, &FakeServerDetails)
scanner, err := NewJasScanner(workingDirs, &FakeServerDetails, "")
assert.NoError(t, err)
return scanner, func() {
assert.NoError(t, scanner.ScannerDirCleanupFunc())
Expand Down
4 changes: 2 additions & 2 deletions xray/commands/audit/jasrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (
)

func runJasScannersAndSetResults(scanResults *utils.ExtendedScanResults, directDependencies []string,
serverDetails *config.ServerDetails, workingDirs []string, progress io.ProgressMgr) (err error) {
serverDetails *config.ServerDetails, workingDirs []string, progress io.ProgressMgr, multiScanId string) (err error) {
if serverDetails == nil || len(serverDetails.Url) == 0 {
log.Warn("To include 'Advanced Security' scan as part of the audit output, please run the 'jf c add' command before running this command.")
return
}
scanner, err := jas.NewJasScanner(workingDirs, serverDetails)
scanner, err := jas.NewJasScanner(workingDirs, serverDetails, multiScanId)
if err != nil {
return
}
Expand Down
6 changes: 3 additions & 3 deletions xray/commands/audit/jasrunner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ func TestGetExtendedScanResults_AnalyzerManagerDoesntExist(t *testing.T) {
assert.NoError(t, os.Unsetenv(coreutils.HomeDir))
}()
scanResults := &utils.ExtendedScanResults{XrayResults: jas.FakeBasicXrayResults, ScannedTechnologies: []coreutils.Technology{coreutils.Yarn}}
err = runJasScannersAndSetResults(scanResults, []string{"issueId_1_direct_dependency", "issueId_2_direct_dependency"}, &jas.FakeServerDetails, nil, nil)
err = runJasScannersAndSetResults(scanResults, []string{"issueId_1_direct_dependency", "issueId_2_direct_dependency"}, &jas.FakeServerDetails, nil, nil, "")
// Expect error:
assert.Error(t, err)
}

func TestGetExtendedScanResults_ServerNotValid(t *testing.T) {
scanResults := &utils.ExtendedScanResults{XrayResults: jas.FakeBasicXrayResults, ScannedTechnologies: []coreutils.Technology{coreutils.Pip}}
err := runJasScannersAndSetResults(scanResults, []string{"issueId_1_direct_dependency", "issueId_2_direct_dependency"}, nil, nil, nil)
err := runJasScannersAndSetResults(scanResults, []string{"issueId_1_direct_dependency", "issueId_2_direct_dependency"}, nil, nil, nil, "")
assert.NoError(t, err)
}

func TestGetExtendedScanResults_AnalyzerManagerReturnsError(t *testing.T) {
mockDirectDependencies := []string{"issueId_2_direct_dependency", "issueId_1_direct_dependency"}
assert.NoError(t, rtutils.DownloadAnalyzerManagerIfNeeded())
scanResults := &utils.ExtendedScanResults{XrayResults: jas.FakeBasicXrayResults, ScannedTechnologies: []coreutils.Technology{coreutils.Yarn}}
err := runJasScannersAndSetResults(scanResults, mockDirectDependencies, &jas.FakeServerDetails, nil, nil)
err := runJasScannersAndSetResults(scanResults, mockDirectDependencies, &jas.FakeServerDetails, nil, nil, "")

// Expect error:
assert.ErrorContains(t, err, "failed to run Applicability scan")
Expand Down
2 changes: 1 addition & 1 deletion xray/commands/audit/scarunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func runScaScanOnWorkingDir(params *AuditParams, results *Results, workingDir, r
technologies = coreutils.DetectedTechnologiesList()
}
if len(technologies) == 0 {
log.Info("Couldn't determine a package manager or build tool used by this project. Skipping the SCA scan...")
log.Info("Couldn't determine a package manager or build tool used by this project. Skipping the SCA services...")
return
}
serverDetails, err := params.ServerDetails()
Expand Down
3 changes: 1 addition & 2 deletions xray/commands/scan/buildscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
xrutils "github.com/jfrog/jfrog-cli-core/v2/xray/utils"
clientutils "github.com/jfrog/jfrog-client-go/utils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray"
"github.com/jfrog/jfrog-client-go/xray/services"
)

Expand Down Expand Up @@ -112,7 +111,7 @@ func (bsc *BuildScanCommand) Run() (err error) {
return
}

func (bsc *BuildScanCommand) runBuildScanAndPrintResults(xrayManager *xray.XrayServicesManager, params services.XrayBuildParams) (isFailBuildResponse bool, err error) {
func (bsc *BuildScanCommand) runBuildScanAndPrintResults(xrayManager services.SecurityServiceManager, params services.XrayBuildParams) (isFailBuildResponse bool, err error) {
buildScanResults, noFailBuildPolicy, err := xrayManager.BuildScan(params, bsc.includeVulnerabilities)
if err != nil {
return false, err
Expand Down
6 changes: 3 additions & 3 deletions xray/commands/scan/downloadindexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package scan
import (
"errors"
"fmt"
"github.com/jfrog/jfrog-client-go/xray/services"
"net/http"
"os"
"path/filepath"
Expand All @@ -19,15 +20,14 @@ import (
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/io/fileutils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray"
)

const (
indexerDirName = "xray-indexer"
tempIndexerDirName = "temp"
)

func DownloadIndexerIfNeeded(xrayManager *xray.XrayServicesManager, xrayVersionStr string) (indexerPath string, err error) {
func DownloadIndexerIfNeeded(xrayManager services.SecurityServiceManager, xrayVersionStr string) (indexerPath string, err error) {
dependenciesPath, err := config.GetJfrogDependenciesPath()
if err != nil {
return
Expand Down Expand Up @@ -64,7 +64,7 @@ func DownloadIndexerIfNeeded(xrayManager *xray.XrayServicesManager, xrayVersionS
return
}

func downloadIndexer(xrayManager *xray.XrayServicesManager, indexerDirPath, indexerBinaryName string) (string, error) {
func downloadIndexer(xrayManager services.SecurityServiceManager, indexerDirPath, indexerBinaryName string) (string, error) {
tempDirPath := filepath.Join(indexerDirPath, tempIndexerDirName)

// Delete the temporary directory if it exists
Expand Down
2 changes: 1 addition & 1 deletion xray/commands/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"github.com/jfrog/jfrog-cli-core/v2/xray/scangraph"
"github.com/jfrog/jfrog-client-go/xray/services"
xrayUtils "github.com/jfrog/jfrog-client-go/xray/services/utils"
"os/exec"
"path/filepath"
Expand All @@ -24,7 +25,6 @@ import (
ioUtils "github.com/jfrog/jfrog-client-go/utils/io"
"github.com/jfrog/jfrog-client-go/utils/io/fileutils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray/services"
)

type FileContext func(string) parallel.TaskFunc
Expand Down
3 changes: 2 additions & 1 deletion xray/scangraph/scangraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
const (
GraphScanMinXrayVersion = "3.29.0"
ScanTypeMinXrayVersion = "3.37.2"
XscMinVersion = "0.1.0"
)

func RunScanGraphAndGetResults(params *ScanGraphParams) (*services.ScanResponse, error) {
Expand All @@ -24,7 +25,7 @@ func RunScanGraphAndGetResults(params *ScanGraphParams) (*services.ScanResponse,
// Remove scan type param if Xray version is under the minimum supported version
params.xrayGraphScanParams.ScanType = ""
}
scanId, err := xrayManager.ScanGraph(*params.xrayGraphScanParams)
scanId, err := xrayManager.ScanGraph(params.xrayGraphScanParams)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions xray/utils/analyzermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package utils
import (
"errors"
"fmt"
"github.com/jfrog/jfrog-client-go/xray/services"

"github.com/jfrog/gofrog/version"
"os"
"os/exec"
Expand All @@ -14,7 +16,6 @@ import (
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/io/fileutils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray/services"
)

type SarifLevel string
Expand Down Expand Up @@ -120,13 +121,14 @@ func (e *ExtendedScanResults) getXrayScanResults() []services.ScanResponse {

type AnalyzerManager struct {
AnalyzerManagerFullPath string
MultiScanId string
}

func (am *AnalyzerManager) Exec(configFile, scanCommand, workingDir string, serverDetails *config.ServerDetails) (err error) {
if err = SetAnalyzerManagerEnvVariables(serverDetails); err != nil {
return err
}
cmd := exec.Command(am.AnalyzerManagerFullPath, scanCommand, configFile)
cmd := exec.Command(am.AnalyzerManagerFullPath, scanCommand, configFile, am.MultiScanId)
defer func() {
if !cmd.ProcessState.Exited() {
if killProcessError := cmd.Process.Kill(); errorutils.CheckError(killProcessError) != nil {
Expand Down
11 changes: 5 additions & 6 deletions xray/utils/resultstable.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@ package utils

import (
"fmt"
"os"
"sort"
"strconv"
"strings"

"github.com/jfrog/gofrog/datastructures"
"github.com/jfrog/jfrog-client-go/xray/services"
"golang.org/x/exp/maps"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"os"
"sort"
"strconv"
"strings"

"github.com/jfrog/jfrog-cli-core/v2/xray/formats"

"github.com/gookit/color"
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray/services"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion xray/utils/resultstable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"fmt"
"github.com/jfrog/jfrog-cli-core/v2/xray/formats"
"github.com/jfrog/jfrog-client-go/xray/services"
"testing"

"github.com/jfrog/jfrog-client-go/xray/services"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion xray/utils/resultwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/jfrog/jfrog-client-go/xray/services"
"os"
"strconv"
"strings"
Expand All @@ -14,7 +15,6 @@ import (
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/io/fileutils"
"github.com/jfrog/jfrog-client-go/utils/log"
"github.com/jfrog/jfrog-client-go/xray/services"
"github.com/owenrumney/go-sarif/v2/sarif"
)

Expand Down
2 changes: 1 addition & 1 deletion xray/utils/resultwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package utils

import (
"fmt"
"github.com/jfrog/jfrog-client-go/xray/services"
"path"
"testing"

"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
"github.com/jfrog/jfrog-cli-core/v2/xray/formats"
"github.com/jfrog/jfrog-client-go/xray/services"
"github.com/stretchr/testify/assert"
)

Expand Down
Loading
Loading