diff --git a/osv/json.go b/osv/json.go index 1ee0867f..a6ae57ae 100644 --- a/osv/json.go +++ b/osv/json.go @@ -120,6 +120,7 @@ type Reference struct { // entry type Entry struct { ID string `json:"id"` + Module string `json:"module"` Published time.Time `json:"published"` Modified time.Time `json:"modified"` Withdrawn *time.Time `json:"withdrawn,omitempty"` @@ -142,6 +143,7 @@ func Generate(id string, url string, r report.Report) []Entry { } entry := Entry{ ID: id, + Module: r.Module, Published: r.Published, Modified: lastModified, Withdrawn: r.Withdrawn, @@ -182,6 +184,7 @@ func Generate(id string, url string, r report.Report) []Entry { if additional.Package != "" { additionalImportPath = additional.Package } + entryCopy.Module = additional.Module entryCopy.Package.Name = additionalImportPath entryCopy.EcosystemSpecific.Symbols = additional.Symbols entryCopy.Affects = generateAffects(additional.Versions) diff --git a/osv/json_test.go b/osv/json_test.go index 39bfa5de..f1a7ce81 100644 --- a/osv/json_test.go +++ b/osv/json_test.go @@ -47,7 +47,8 @@ func TestGenerate(t *testing.T) { want := []Entry{ { - ID: "GO-1991-0001", + ID: "GO-1991-0001", + Module: "example.com/vulnerable/v2", Package: Package{ Name: "example.com/vulnerable/v2", Ecosystem: "Go", @@ -85,8 +86,8 @@ func TestGenerate(t *testing.T) { }, }, { - - ID: "GO-1991-0001", + ID: "GO-1991-0001", + Module: "vanity.host/vulnerable", Package: Package{ Name: "vanity.host/vulnerable/package", Ecosystem: "Go",