From f145540ca55099004bbd58411576cdc0b31c2385 Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Wed, 8 Jan 2025 17:55:01 -0500 Subject: [PATCH] fix vuln status enum related tests Signed-off-by: Alex Goodman --- .../v6/transformers/github/transform_test.go | 10 +++++----- .../v6/transformers/nvd/transform_test.go | 20 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/process/v6/transformers/github/transform_test.go b/pkg/process/v6/transformers/github/transform_test.go index 0882932f..d585792b 100644 --- a/pkg/process/v6/transformers/github/transform_test.go +++ b/pkg/process/v6/transformers/github/transform_test.go @@ -88,7 +88,7 @@ func TestGetVulnerability(t *testing.T) { ModifiedDate: internal.ParseTime("2024-02-08T22:48:31Z"), PublishedDate: internal.ParseTime("2024-01-30T20:56:46Z"), WithdrawnDate: nil, - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "GHSA-2wgc-48g2-cj5w", Description: "vantage6 has insecure SSH configuration for node and server containers", @@ -130,7 +130,7 @@ func TestGetVulnerability(t *testing.T) { ModifiedDate: internal.ParseTime("2024-03-21T17:48:19Z"), PublishedDate: internal.ParseTime("2023-06-13T18:30:39Z"), WithdrawnDate: internal.ParseTime("2023-06-28T23:54:39Z"), - Status: string(grypeDB.VulnerabilityRejected), + Status: grypeDB.VulnerabilityRejected, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "GHSA-3x74-v64j-qc3f", Description: "Withdrawn Advisory: CraftCMS Server-Side Template Injection vulnerability", @@ -172,7 +172,7 @@ func TestGetVulnerability(t *testing.T) { ModifiedDate: internal.ParseTime("2023-01-09T05:03:39Z"), PublishedDate: internal.ParseTime("2020-07-27T19:55:52Z"), WithdrawnDate: nil, - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "GHSA-vc9j-fhvv-8vrf", Description: "Remote Code Execution in scratch-vm", @@ -273,7 +273,7 @@ func TestGetVulnerability(t *testing.T) { ModifiedDate: nil, PublishedDate: nil, WithdrawnDate: internal.ParseTime("2022-01-31T14:32:09Z"), - Status: string(grypeDB.VulnerabilityRejected), + Status: grypeDB.VulnerabilityRejected, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "GHSA-6cwv-x26c-w2q4", Description: "Low severity vulnerability that affects notebook", @@ -304,7 +304,7 @@ func TestGetVulnerability(t *testing.T) { Version: "1", DateCaptured: &now, }, - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "GHSA-p5wr-vp8g-q5p4", Description: "Moderate severity vulnerability that affects Plone", diff --git a/pkg/process/v6/transformers/nvd/transform_test.go b/pkg/process/v6/transformers/nvd/transform_test.go index 53a438fd..990c4169 100644 --- a/pkg/process/v6/transformers/nvd/transform_test.go +++ b/pkg/process/v6/transformers/nvd/transform_test.go @@ -62,7 +62,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2018, 7, 5, 13, 52, 30, 627000000, time.UTC)), PublishedDate: timeRef(time.Date(2018, 5, 24, 14, 29, 0, 390000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2018-5487", Assigners: []string{"security-alert@netapp.com"}, @@ -138,7 +138,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2020, 3, 31, 2, 15, 12, 667000000, time.UTC)), PublishedDate: timeRef(time.Date(2018, 8, 20, 20, 29, 1, 347000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2018-1000222", Assigners: []string{"cve@mitre.org"}, @@ -226,7 +226,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2018, 5, 23, 14, 41, 49, 73000000, time.UTC)), PublishedDate: timeRef(time.Date(2018, 4, 17, 20, 29, 0, 410000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2018-10189", Assigners: []string{"cve@mitre.org"}, @@ -309,7 +309,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2016, 11, 28, 19, 50, 59, 600000000, time.UTC)), PublishedDate: timeRef(time.Date(2016, 11, 22, 17, 59, 0, 180000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2015-8978", Assigners: []string{"cve@mitre.org"}, @@ -368,7 +368,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2022, 9, 3, 3, 34, 19, 933000000, time.UTC)), PublishedDate: timeRef(time.Date(2022, 3, 10, 17, 47, 45, 383000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2022-26488", Assigners: []string{"cve@mitre.org"}, @@ -475,7 +475,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2023, 9, 29, 15, 55, 24, 533000000, time.UTC)), PublishedDate: timeRef(time.Date(2022, 2, 18, 20, 15, 17, 583000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2022-0543", Assigners: []string{"security@debian.org"}, @@ -570,7 +570,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2021, 12, 10, 19, 57, 6, 357000000, time.UTC)), PublishedDate: timeRef(time.Date(2021, 5, 27, 19, 15, 7, 880000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2020-10729", Assigners: []string{"secalert@redhat.com"}, @@ -661,7 +661,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2023, 8, 26, 2, 25, 42, 957000000, time.UTC)), PublishedDate: timeRef(time.Date(2023, 8, 22, 22, 15, 8, 460000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2023-38733", Assigners: []string{"psirt@us.ibm.com"}, @@ -749,7 +749,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2023, 12, 14, 10, 15, 7, 947000000, time.UTC)), PublishedDate: timeRef(time.Date(2023, 11, 9, 17, 15, 8, 757000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2023-45283", Assigners: []string{"security@golang.org"}, @@ -860,7 +860,7 @@ func TestTransform(t *testing.T) { Provider: expectedProvider("nvd"), ModifiedDate: timeRef(time.Date(2023, 12, 14, 10, 15, 7, 947000000, time.UTC)), PublishedDate: timeRef(time.Date(2023, 11, 9, 17, 15, 8, 757000000, time.UTC)), - Status: string(grypeDB.VulnerabilityActive), + Status: grypeDB.VulnerabilityActive, BlobValue: &grypeDB.VulnerabilityBlob{ ID: "CVE-2023-45283", Assigners: []string{"security@golang.org"},