Skip to content

Commit a226edb

Browse files
authored
Fix breaks from recent changes (#569)
1 parent ad84a61 commit a226edb

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

utils/formats/snapshotconvertor/githubsnapshotconvertor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const (
1616
indirectDependency = "indirect"
1717
)
1818

19-
func CreateGithubSnapshotFromSbom(bom *cyclonedx.BOM, snapshotVersion int, scanTime time.Time, jobId, jobCorrelator, commitSha, gitRef, detectorName, detectorVersion, detectorUrl string) (*vcsclient.SbomSnapshot, error) {
19+
func CreateGithubSnapshotFromSbom(bom *cdxutils.FullBOM, snapshotVersion int, scanTime time.Time, jobId, jobCorrelator, commitSha, gitRef, detectorName, detectorVersion, detectorUrl string) (*vcsclient.SbomSnapshot, error) {
2020
if bom == nil {
2121
return nil, errors.New("received cycloneDX is nil")
2222
}
@@ -69,7 +69,7 @@ func CreateGithubSnapshotFromSbom(bom *cyclonedx.BOM, snapshotVersion int, scanT
6969
resolvedDependencies := make(map[string]*vcsclient.ResolvedDependency)
7070
for _, component := range componentsList {
7171
var relationship string
72-
bomRelationship := cdxutils.GetComponentRelation(bom, component.BOMRef, false)
72+
bomRelationship := cdxutils.GetComponentRelation(&bom.BOM, component.BOMRef, false)
7373
switch bomRelationship {
7474
case cdxutils.RootRelation:
7575
continue

utils/formats/snapshotconvertor/githubsnapshotconvertor_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/CycloneDX/cyclonedx-go"
88
"github.com/jfrog/froggit-go/vcsclient"
9+
"github.com/jfrog/jfrog-cli-security/utils/formats/cdxutils"
910
"github.com/stretchr/testify/assert"
1011
)
1112

@@ -226,7 +227,7 @@ func TestCreateGithubSnapshotFromSbom(t *testing.T) {
226227

227228
for _, test := range testCases {
228229
t.Run(test.name, func(t *testing.T) {
229-
var bom *cyclonedx.BOM
230+
var bom *cdxutils.FullBOM
230231
if test.components == nil {
231232
bom = nil
232233
} else {
@@ -264,15 +265,16 @@ func TestCreateGithubSnapshotFromSbom(t *testing.T) {
264265
}
265266

266267
// createTestBOM creates a test BOM with the specified components and dependencies
267-
func createTestBOM(components []cyclonedx.Component, dependencies []cyclonedx.Dependency) *cyclonedx.BOM {
268-
bom := cyclonedx.NewBOM()
268+
func createTestBOM(components []cyclonedx.Component, dependencies []cyclonedx.Dependency) *cdxutils.FullBOM {
269+
innerBom := cyclonedx.NewBOM()
269270
if len(components) > 0 {
270-
bom.Components = &components
271+
innerBom.Components = &components
271272
}
272273
if len(dependencies) > 0 {
273-
bom.Dependencies = &dependencies
274+
innerBom.Dependencies = &dependencies
274275
}
275-
return bom
276+
fullBom := cdxutils.FullBOM{BOM: *innerBom}
277+
return &fullBom
276278
}
277279

278280
// createTestComponent creates a test component with evidence occurrences

0 commit comments

Comments
 (0)