From 4c2a3d6b2606ad7f3215b662cb0d478f8cf673a6 Mon Sep 17 00:00:00 2001 From: suraj-jadhav-ot Date: Tue, 4 Aug 2026 12:30:56 +0530 Subject: [PATCH 1/3] 8055: Respect --no-resolve for Python (pip) scans by disabling backend dependency resolution --- internal/scan/scanner.go | 1 + internal/upload/batch.go | 6 +++++- internal/upload/batch_test.go | 12 ++++++------ internal/upload/uploader.go | 2 ++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/internal/scan/scanner.go b/internal/scan/scanner.go index b586ac21..24de8bd7 100644 --- a/internal/scan/scanner.go +++ b/internal/scan/scanner.go @@ -297,6 +297,7 @@ func (dScanner *DebrickedScanner) scan(options DebrickedOptions, gitMetaObject g DebrickedConfig: dScanner.getDebrickedConfig(options.Path, options.Exclusions, options.Inclusions), TagCommitAsRelease: options.TagCommitAsRelease, Experimental: options.Experimental, + NoResolve: !options.Resolve, } result, err := (*dScanner.uploader).Upload(uploaderOptions) if err != nil { diff --git a/internal/upload/batch.go b/internal/upload/batch.go index e1a946bf..23d56073 100644 --- a/internal/upload/batch.go +++ b/internal/upload/batch.go @@ -47,12 +47,13 @@ type uploadBatch struct { debrickedConfig *DebrickedConfig // JSON Config tagCommitAsRelease bool experimental bool + noResolve bool } func newUploadBatch( client *client.IDebClient, fileGroups file.Groups, gitMetaObject *git.MetaObject, integrationName string, callGraphTimeout int, versionHint bool, - debrickedConfig *DebrickedConfig, tagCommitAsRelease bool, experimental bool, + debrickedConfig *DebrickedConfig, tagCommitAsRelease bool, experimental bool, noResolve bool, ) *uploadBatch { return &uploadBatch{ client: client, @@ -65,6 +66,7 @@ func newUploadBatch( debrickedConfig: debrickedConfig, tagCommitAsRelease: tagCommitAsRelease, experimental: experimental, + noResolve: noResolve, } } @@ -194,6 +196,7 @@ func (uploadBatch *uploadBatch) initAnalysis() error { DebrickedIntegration: "cli", TagCommitAsRelease: uploadBatch.tagCommitAsRelease, Experimental: uploadBatch.experimental, + NoResolve: uploadBatch.noResolve, }) if err != nil { @@ -363,6 +366,7 @@ type uploadFinish struct { DebrickedConfig *DebrickedConfig `json:"debrickedConfig"` TagCommitAsRelease bool `json:"isRelease"` Experimental bool `json:"experimental"` + NoResolve bool `json:"noResolve"` } func getRelativeFilePath(filePath string) string { diff --git a/internal/upload/batch_test.go b/internal/upload/batch_test.go index d9e47739..6426cae0 100644 --- a/internal/upload/batch_test.go +++ b/internal/upload/batch_test.go @@ -38,7 +38,7 @@ func TestUploadWithBadFiles(t *testing.T) { clientMock.AddMockResponse(mockRes) clientMock.AddMockResponse(mockRes) c = clientMock - batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false) + batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false, false) var buf bytes.Buffer log.SetOutput(&buf) err = batch.upload() @@ -50,7 +50,7 @@ func TestUploadWithBadFiles(t *testing.T) { } func TestInitAnalysisWithoutAnyFiles(t *testing.T) { - batch := newUploadBatch(nil, file.Groups{}, nil, "CLI", 10*60, true, &DebrickedConfig{}, true, false) + batch := newUploadBatch(nil, file.Groups{}, nil, "CLI", 10*60, true, &DebrickedConfig{}, true, false, false) err := batch.initAnalysis() assert.ErrorContains(t, err, "failed to find dependency files") @@ -73,7 +73,7 @@ func TestWaitWithPollingTerminatedError(t *testing.T) { } clientMock.AddMockResponse(mockRes) c = clientMock - batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false) + batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false, false) uploadResult, err := batch.wait() @@ -98,7 +98,7 @@ func TestInitUploadBadFile(t *testing.T) { clientMock.AddMockResponse(mockRes) var c client.IDebClient = clientMock - batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false) + batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false, false) files, err := batch.initUpload() @@ -120,7 +120,7 @@ func TestInitUploadFingerprintsFree(t *testing.T) { clientMock := testdata.NewDebClientMock() clientMock.SetEnterpriseCustomer(false) var c client.IDebClient = clientMock - batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false) + batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false, false) files, err := batch.initUpload() @@ -145,7 +145,7 @@ func TestInitUpload(t *testing.T) { clientMock.AddMockResponse(mockRes) var c client.IDebClient = clientMock - batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false) + batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false, false) files, err := batch.initUpload() diff --git a/internal/upload/uploader.go b/internal/upload/uploader.go index a8dfb4f4..6c50cd06 100644 --- a/internal/upload/uploader.go +++ b/internal/upload/uploader.go @@ -19,6 +19,7 @@ type DebrickedOptions struct { DebrickedConfig *DebrickedConfig TagCommitAsRelease bool Experimental bool + NoResolve bool } type IUploader interface { @@ -49,6 +50,7 @@ func (uploader *Uploader) Upload(o IOptions) (*UploadResult, error) { dOptions.DebrickedConfig, dOptions.TagCommitAsRelease, dOptions.Experimental, + dOptions.NoResolve, ) err := batch.upload() From 924bf547957e7a764467fc70d9790bd150a4d2e6 Mon Sep 17 00:00:00 2001 From: suraj-jadhav-ot Date: Tue, 4 Aug 2026 14:19:51 +0530 Subject: [PATCH 2/3] 8055: Respect --no-resolve for Python (pip) scans by disabling backend dependency resolution --- internal/upload/batch_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/upload/batch_test.go b/internal/upload/batch_test.go index 6426cae0..6676ea44 100644 --- a/internal/upload/batch_test.go +++ b/internal/upload/batch_test.go @@ -388,7 +388,7 @@ func TestInitUploadSPDX(t *testing.T) { clientMock.AddMockResponse(mockRes) var c client.IDebClient = clientMock - batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false) + batch := newUploadBatch(&c, groups, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, true, false, false) files, err := batch.initUpload() From 23b4dfbeb683a63fd28ad6ff2bc5a5a293117089 Mon Sep 17 00:00:00 2001 From: suraj-jadhav-ot Date: Wed, 5 Aug 2026 11:23:16 +0530 Subject: [PATCH 3/3] 8055: Respect --no-resolve for Python (pip) scans by disabling backend dependency resolution --- internal/upload/batch_test.go | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/internal/upload/batch_test.go b/internal/upload/batch_test.go index 6676ea44..32904990 100644 --- a/internal/upload/batch_test.go +++ b/internal/upload/batch_test.go @@ -56,6 +56,46 @@ func TestInitAnalysisWithoutAnyFiles(t *testing.T) { assert.ErrorContains(t, err, "failed to find dependency files") } +func TestInitAnalysisNoResolve(t *testing.T) { + metaObj, err := git.NewMetaObject("", "repository-name", "commit-name", "", "", "") + if err != nil { + t.Fatal("failed to create new MetaObject") + } + + clientMock := testdata.NewDebClientMock() + clientMock.AddMockResponse(testdata.MockResponse{ + StatusCode: http.StatusNoContent, + ResponseBody: io.NopCloser(strings.NewReader("")), + }) + var c client.IDebClient = clientMock + batch := newUploadBatch(&c, file.Groups{}, metaObj, "CLI", 10*60, true, &DebrickedConfig{}, false, false, true) + batch.ciUploadId = 1 + + assert.True(t, batch.noResolve) + err = batch.initAnalysis() + assert.NoError(t, err) +} + +func TestUploadFinishNoResolveJSON(t *testing.T) { + finish := uploadFinish{ + CiUploadId: "1", + NoResolve: true, + } + body, err := json.Marshal(finish) + assert.NoError(t, err) + assert.Contains(t, string(body), `"noResolve":true`) +} + +func TestUploadFinishResolveJSON(t *testing.T) { + finish := uploadFinish{ + CiUploadId: "1", + NoResolve: false, + } + body, err := json.Marshal(finish) + assert.NoError(t, err) + assert.Contains(t, string(body), `"noResolve":false`) +} + func TestWaitWithPollingTerminatedError(t *testing.T) { group := file.NewGroup("package.json", nil, []string{"yarn.lock"}) var groups file.Groups