From cdf987b67e28d3e4d54065a44fd68f2260f8448e Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Thu, 12 Jan 2023 11:14:18 -0800 Subject: [PATCH 1/2] Bump github.com/spdx/tools-golang to v0.4.0 Signed-off-by: Luca Comellini --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7d234ae2040f..b05e3a4579be 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e github.com/sergi/go-diff v1.2.0 github.com/sirupsen/logrus v1.9.0 - github.com/spdx/tools-golang v0.3.1-0.20221108182156-8a01147e6342 + github.com/spdx/tools-golang v0.4.0 github.com/spf13/afero v1.8.2 github.com/spf13/cobra v1.6.0 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index dc94afa5d3ef..82335f661de7 100644 --- a/go.sum +++ b/go.sum @@ -1208,8 +1208,8 @@ github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4l github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spdx/gordf v0.0.0-20201111095634-7098f93598fb/go.mod h1:uKWaldnbMnjsSAXRurWqqrdyZen1R7kxl8TkmWk2OyM= -github.com/spdx/tools-golang v0.3.1-0.20221108182156-8a01147e6342 h1:6uvaOTv4GeRqQV6O1/znbpziqhctMRLTy3OGeZrNMic= -github.com/spdx/tools-golang v0.3.1-0.20221108182156-8a01147e6342/go.mod h1:VHzvNsKAfAGqs4ZvwRL+7a0dNsL20s7lGui4K9C0xQM= +github.com/spdx/tools-golang v0.4.0 h1:jdhnW8zYelURCbYTphiviFKZkWu51in0E4A1KT2csP0= +github.com/spdx/tools-golang v0.4.0/go.mod h1:VHzvNsKAfAGqs4ZvwRL+7a0dNsL20s7lGui4K9C0xQM= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= From 5a144006911625bed0b7de1eb122e5abcd803176 Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Fri, 20 Jan 2023 16:45:36 -0500 Subject: [PATCH 2/2] chore: update spdx json snapshots Signed-off-by: Keith Zantow --- syft/formats/spdxjson/encoder_test.go | 6 +++--- .../TestSPDXJSONDirectoryEncoder.golden | 17 ++++++----------- .../snapshot/TestSPDXJSONImageEncoder.golden | 17 ++++++----------- .../snapshot/TestSPDXRelationshipOrder.golden | 17 ++++++----------- 4 files changed, 21 insertions(+), 36 deletions(-) diff --git a/syft/formats/spdxjson/encoder_test.go b/syft/formats/spdxjson/encoder_test.go index a6050a19cc43..90f1342841b0 100644 --- a/syft/formats/spdxjson/encoder_test.go +++ b/syft/formats/spdxjson/encoder_test.go @@ -48,11 +48,11 @@ func TestSPDXRelationshipOrder(t *testing.T) { func spdxJsonRedactor(s []byte) []byte { // each SBOM reports the time it was generated, which is not useful during snapshot testing - s = regexp.MustCompile(`"created":\s+"[^"]*",?`).ReplaceAll(s, []byte("")) + s = regexp.MustCompile(`"created":\s+"[^"]*"`).ReplaceAll(s, []byte(`"created":""`)) // each SBOM reports a unique documentNamespace when generated, this is not useful for snapshot testing - s = regexp.MustCompile(`"documentNamespace":\s+"[^"]*",?`).ReplaceAll(s, []byte("")) + s = regexp.MustCompile(`"documentNamespace":\s+"[^"]*"`).ReplaceAll(s, []byte(`"documentNamespace":""`)) // the license list will be updated periodically, the value here should not be directly tested in snapshot tests - return regexp.MustCompile(`"licenseListVersion":\s+"[^"]*",?`).ReplaceAll(s, []byte("")) + return regexp.MustCompile(`"licenseListVersion":\s+"[^"]*"`).ReplaceAll(s, []byte(`"licenseListVersion":""`)) } diff --git a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONDirectoryEncoder.golden b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONDirectoryEncoder.golden index a8041b2622a1..4ef14120dfe8 100644 --- a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONDirectoryEncoder.golden +++ b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONDirectoryEncoder.golden @@ -3,15 +3,14 @@ "dataLicense": "CC0-1.0", "SPDXID": "SPDXRef-DOCUMENT", "name": "/some/path", - "documentNamespace": "https://anchore.com/syft/dir/some/path-e13c8924-4bbc-42f8-bd30-4e1554472d62", + "documentNamespace": "https://anchore.com/syft/dir/some/path-1fe34646-a616-48c7-974b-3d1e27d406e3", "creationInfo": { "licenseListVersion": "3.19", "creators": [ "Organization: Anchore, Inc", "Tool: syft-v0.42.0-bogus" ], - "created": "2022-12-22T23:33:52Z", - "comment": "" + "created": "2023-01-20T21:41:03Z" }, "packages": [ { @@ -27,14 +26,12 @@ { "referenceCategory": "SECURITY", "referenceType": "cpe23Type", - "referenceLocator": "cpe:2.3:*:some:package:2:*:*:*:*:*:*:*", - "comment": "" + "referenceLocator": "cpe:2.3:*:some:package:2:*:*:*:*:*:*:*" }, { "referenceCategory": "PACKAGE-MANAGER", "referenceType": "purl", - "referenceLocator": "a-purl-2", - "comment": "" + "referenceLocator": "a-purl-2" } ] }, @@ -51,14 +48,12 @@ { "referenceCategory": "SECURITY", "referenceType": "cpe23Type", - "referenceLocator": "cpe:2.3:*:some:package:2:*:*:*:*:*:*:*", - "comment": "" + "referenceLocator": "cpe:2.3:*:some:package:2:*:*:*:*:*:*:*" }, { "referenceCategory": "PACKAGE-MANAGER", "referenceType": "purl", - "referenceLocator": "pkg:deb/debian/package-2@2.0.1", - "comment": "" + "referenceLocator": "pkg:deb/debian/package-2@2.0.1" } ] } diff --git a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONImageEncoder.golden b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONImageEncoder.golden index beff67607528..8a5214f293ff 100644 --- a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONImageEncoder.golden +++ b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONImageEncoder.golden @@ -3,15 +3,14 @@ "dataLicense": "CC0-1.0", "SPDXID": "SPDXRef-DOCUMENT", "name": "user-image-input", - "documentNamespace": "https://anchore.com/syft/image/user-image-input-a1cc9d58-830a-4a4b-9dcd-f41ea3001216", + "documentNamespace": "https://anchore.com/syft/image/user-image-input-33759ac3-6006-4f2c-bdc4-f40b9287a7f0", "creationInfo": { "licenseListVersion": "3.19", "creators": [ "Organization: Anchore, Inc", "Tool: syft-v0.42.0-bogus" ], - "created": "2022-12-22T23:33:53Z", - "comment": "" + "created": "2023-01-20T21:41:03Z" }, "packages": [ { @@ -27,14 +26,12 @@ { "referenceCategory": "SECURITY", "referenceType": "cpe23Type", - "referenceLocator": "cpe:2.3:*:some:package:1:*:*:*:*:*:*:*", - "comment": "" + "referenceLocator": "cpe:2.3:*:some:package:1:*:*:*:*:*:*:*" }, { "referenceCategory": "PACKAGE-MANAGER", "referenceType": "purl", - "referenceLocator": "a-purl-1", - "comment": "" + "referenceLocator": "a-purl-1" } ] }, @@ -51,14 +48,12 @@ { "referenceCategory": "SECURITY", "referenceType": "cpe23Type", - "referenceLocator": "cpe:2.3:*:some:package:2:*:*:*:*:*:*:*", - "comment": "" + "referenceLocator": "cpe:2.3:*:some:package:2:*:*:*:*:*:*:*" }, { "referenceCategory": "PACKAGE-MANAGER", "referenceType": "purl", - "referenceLocator": "pkg:deb/debian/package-2@2.0.1", - "comment": "" + "referenceLocator": "pkg:deb/debian/package-2@2.0.1" } ] } diff --git a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXRelationshipOrder.golden b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXRelationshipOrder.golden index 599488984a57..9e8e1453cc1a 100644 --- a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXRelationshipOrder.golden +++ b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXRelationshipOrder.golden @@ -3,15 +3,14 @@ "dataLicense": "CC0-1.0", "SPDXID": "SPDXRef-DOCUMENT", "name": "user-image-input", - "documentNamespace": "https://anchore.com/syft/image/user-image-input-fc663ee3-0f9b-402e-827f-3f29aeff164e", + "documentNamespace": "https://anchore.com/syft/image/user-image-input-ce98f51f-b483-4e93-9a15-5a8a16d35de6", "creationInfo": { "licenseListVersion": "3.19", "creators": [ "Organization: Anchore, Inc", "Tool: syft-v0.42.0-bogus" ], - "created": "2022-12-22T23:33:53Z", - "comment": "" + "created": "2023-01-20T21:41:03Z" }, "packages": [ { @@ -27,14 +26,12 @@ { "referenceCategory": "SECURITY", "referenceType": "cpe23Type", - "referenceLocator": "cpe:2.3:*:some:package:1:*:*:*:*:*:*:*", - "comment": "" + "referenceLocator": "cpe:2.3:*:some:package:1:*:*:*:*:*:*:*" }, { "referenceCategory": "PACKAGE-MANAGER", "referenceType": "purl", - "referenceLocator": "a-purl-1", - "comment": "" + "referenceLocator": "a-purl-1" } ] }, @@ -51,14 +48,12 @@ { "referenceCategory": "SECURITY", "referenceType": "cpe23Type", - "referenceLocator": "cpe:2.3:*:some:package:2:*:*:*:*:*:*:*", - "comment": "" + "referenceLocator": "cpe:2.3:*:some:package:2:*:*:*:*:*:*:*" }, { "referenceCategory": "PACKAGE-MANAGER", "referenceType": "purl", - "referenceLocator": "pkg:deb/debian/package-2@2.0.1", - "comment": "" + "referenceLocator": "pkg:deb/debian/package-2@2.0.1" } ] }