Skip to content

Commit 708d76d

Browse files
tatianabTatiana Bradley
authored and
Tatiana Bradley
committed
internal/ghsa: add references to SecurityAdvisory
Adds a field References to the SecurityAdvisory, and populate the field via the GHSA client. This will allow us to populate references for GHSAs in vulnreport create. Change-Id: I59b63a68bd5d3b8a122f233a40ff0915ee9f9481 Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/459837 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Tim King <[email protected]> Reviewed-by: Tatiana Bradley <[email protected]> Run-TryBot: Tatiana Bradley <[email protected]>
1 parent 5f46aab commit 708d76d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/ghsa/ghsa.go

+9
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ type SecurityAdvisory struct {
3030
Permalink string
3131
// When the advisory was first published.
3232
PublishedAt time.Time
33+
// References linked to by this advisory.
34+
References []Reference
3335
// When the advisory was last updated; should always be >= PublishedAt.
3436
UpdatedAt time.Time
3537
// The vulnerabilities associated with this advisory.
@@ -43,6 +45,11 @@ type Identifier struct {
4345
Value string
4446
}
4547

48+
// A Reference is a URL linked to by the advisory.
49+
type Reference struct {
50+
URL string
51+
}
52+
4653
// A Vuln represents a vulnerability.
4754
type Vuln struct {
4855
// The vulnerable Go package or module.
@@ -68,6 +75,7 @@ type gqlSecurityAdvisory struct {
6875
Description string
6976
Origin string
7077
Permalink githubv4.URI
78+
References []Reference
7179
PublishedAt time.Time
7280
UpdatedAt time.Time
7381
Vulnerabilities struct {
@@ -104,6 +112,7 @@ func (sa *gqlSecurityAdvisory) securityAdvisory() (*SecurityAdvisory, error) {
104112
Description: sa.Description,
105113
Origin: sa.Origin,
106114
Permalink: sa.Permalink.URL.String(),
115+
References: sa.References,
107116
PublishedAt: sa.PublishedAt,
108117
UpdatedAt: sa.UpdatedAt,
109118
}

0 commit comments

Comments
 (0)