Skip to content

Commit ed0fd57

Browse files
committed
cmd/vulnreport, internal/report: add support for summary field in YAML
Adds a field, "summary", which corresponds to the OSV "summary" and CVE "title" field. This field is pulled automatically from GHSAs in "vulnreport create". Currently, this field is not required and is not populated in the OSV/CVE conversion. Introducing it now will make it easier for us to begin publishing this field later, to reduce the backfill burden. For golang/go#56443 Change-Id: Ib93efad656daeac4b13a97d83d46952dbced14b5 Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/475336 Reviewed-by: Julie Qiu <[email protected]> Reviewed-by: Tatiana Bradley <[email protected]> Run-TryBot: Tatiana Bradley <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 99d9182 commit ed0fd57

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

cmd/vulnreport/main.go

+3
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,9 @@ func addTODOs(r *report.Report) {
561561
}
562562
}
563563
}
564+
if r.Summary == "" {
565+
r.Summary = "TODO: add a short (one phrase) summary"
566+
}
564567
if r.Description == "" {
565568
r.Description = todo
566569
}

internal/report/ghsa.go

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
// GHSAToReport creates a Report struct from a given GHSA SecurityAdvisory and modulePath.
1515
func GHSAToReport(sa *ghsa.SecurityAdvisory, modulePath string) *Report {
1616
r := &Report{
17+
Summary: sa.Summary,
1718
Description: sa.Description,
1819
}
1920
var cves, ghsas []string

internal/report/report.go

+3
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ type Report struct {
184184

185185
Modules []*Module `yaml:",omitempty"`
186186

187+
// Summary is a short phrase describing the vulnerability.
188+
Summary string `yaml:",omitempty"`
189+
187190
// Description is the CVE description from an existing CVE. If we are
188191
// assigning a CVE ID ourselves, use CVEMetadata.Description instead.
189192
Description string `yaml:",omitempty"`

0 commit comments

Comments
 (0)