diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index c274f07bece..67e624c9e88 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -29,6 +29,15 @@ type AdvisoryCWEs struct { Name *string `json:"name,omitempty"` } +// AdvisoryEPSS represents the advisory pertaining to the Exploit Prediction Scoring System. +// +// For more information, see: +// https://github.blog/changelog/2024-10-10-epss-scores-in-the-github-advisory-database/ +type AdvisoryEPSS struct { + Percentage float64 `json:"percentage"` + Percentile float64 `json:"percentile"` +} + // DependabotSecurityAdvisory represents the GitHub Security Advisory. type DependabotSecurityAdvisory struct { GHSAID *string `json:"ghsa_id,omitempty"` @@ -39,6 +48,7 @@ type DependabotSecurityAdvisory struct { Severity *string `json:"severity,omitempty"` CVSS *AdvisoryCVSS `json:"cvss,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` + EPSS *AdvisoryEPSS `json:"epss,omitempty"` Identifiers []*AdvisoryIdentifier `json:"identifiers,omitempty"` References []*AdvisoryReference `json:"references,omitempty"` PublishedAt *Timestamp `json:"published_at,omitempty"` diff --git a/github/dependabot_alerts_test.go b/github/dependabot_alerts_test.go index 3a46855e011..8410825a2d0 100644 --- a/github/dependabot_alerts_test.go +++ b/github/dependabot_alerts_test.go @@ -281,6 +281,10 @@ func TestDependabotSecurityAdvisory_Marshal(t *testing.T) { Name: Ptr("Exposure of Sensitive Information to an Unauthorized Actor"), }, }, + EPSS: &AdvisoryEPSS{ + Percentage: 0.05, + Percentile: 0.5, + }, Identifiers: []*AdvisoryIdentifier{ { Type: Ptr("GHSA"), @@ -353,6 +357,10 @@ func TestDependabotSecurityAdvisory_Marshal(t *testing.T) { "name": "Exposure of Sensitive Information to an Unauthorized Actor" } ], + "epss": { + "percentage": 0.05, + "percentile": 0.5 + }, "identifiers": [ { "type": "GHSA", diff --git a/github/github-accessors.go b/github/github-accessors.go index 1e2442789d6..4a32702755a 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6854,6 +6854,14 @@ func (d *DependabotSecurityAdvisory) GetDescription() string { return *d.Description } +// GetEPSS returns the EPSS field. +func (d *DependabotSecurityAdvisory) GetEPSS() *AdvisoryEPSS { + if d == nil { + return nil + } + return d.EPSS +} + // GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetGHSAID() string { if d == nil || d.GHSAID == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 8dadb706cd6..9efb190b522 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -8904,6 +8904,14 @@ func TestDependabotSecurityAdvisory_GetDescription(tt *testing.T) { d.GetDescription() } +func TestDependabotSecurityAdvisory_GetEPSS(tt *testing.T) { + tt.Parallel() + d := &DependabotSecurityAdvisory{} + d.GetEPSS() + d = nil + d.GetEPSS() +} + func TestDependabotSecurityAdvisory_GetGHSAID(tt *testing.T) { tt.Parallel() var zeroValue string