Skip to content

Commit 7c3f95c

Browse files
authored
Merge pull request #77 from crozzy/add-vuln-fields
Extend CSAF.Vulnerability object
2 parents 2a62512 + 20ffdc5 commit 7c3f95c

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

pkg/csaf/csaf.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ type Vulnerability struct {
114114
References []Reference `json:"references"`
115115

116116
ReleaseDate time.Time `json:"release_date"`
117+
118+
// Notes holds notes associated with the Vulnerability object.
119+
// https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html#3238-vulnerabilities-property---notes
120+
Notes []Note `json:"notes"`
121+
122+
// Scores holds the scores associated with the Vulnerability object.
123+
// https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html#32313-vulnerabilities-property---scores
124+
// Currently only CVSS v3 is supported.
125+
Scores []Score `json:"scores"`
117126
}
118127

119128
type Note struct {
@@ -203,6 +212,55 @@ type Product struct {
203212
IdentificationHelper map[string]string `json:"product_identification_helper"`
204213
}
205214

215+
// Score contains score information tied to the listed products.
216+
//
217+
// https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html#32313-vulnerabilities-property---scores
218+
type Score struct {
219+
CVSSV2 CVSSV2 `json:"cvss_v2"`
220+
CVSSV3 CVSSV3 `json:"cvss_v3"`
221+
ProductIDs []string `json:"products"`
222+
}
223+
224+
// CVSSV2 describes CVSSv2.0 specification as defined here:
225+
// - https://www.first.org/cvss/cvss-v2.0.json
226+
type CVSSV2 struct {
227+
AccessVector string `json:"accessVector"`
228+
AccessComplexity string `json:"accessComplexity"`
229+
Authentication string `json:"authentication"`
230+
ConfidentialityImpact string `json:"confidentialityImpact"`
231+
IntegrityImpact string `json:"integrityImpact"`
232+
AvailabilityImpact string `json:"availabilityImpact"`
233+
BaseScore float64 `json:"baseScore"`
234+
Exploitability string `json:"exploitability"`
235+
RemediationLevel string `json:"remediationLevel"`
236+
ReportConfidence string `json:"reportConfidence"`
237+
TemporalScore float64 `json:"temporalScore"`
238+
CollateralDamagePotential string `json:"collateralDamagePotential"`
239+
TargetDistribution string `json:"targetDistribution"`
240+
ConfidentialityRequirement string `json:"confidentialityRequirement"`
241+
IntegrityRequirement string `json:"integrityRequirement"`
242+
AvailabilityRequirement string `json:"availabilityRequirement"`
243+
EnvironmentalScore float64 `json:"environmentalScore"`
244+
}
245+
246+
// CVSSV3 describes both the CVSSv3.0 and CVSSv3.1 specifications as defined here:
247+
// - https://www.first.org/cvss/cvss-v3.0.json
248+
// - https://www.first.org/cvss/cvss-v3.1.json
249+
type CVSSV3 struct {
250+
AttackComplexity string `json:"attackComplexity"`
251+
AttackVector string `json:"attackVector"`
252+
AvailabilityImpact string `json:"availabilityImpact"`
253+
BaseScore float64 `json:"baseScore"`
254+
BaseSeverity string `json:"baseSeverity"`
255+
ConfidentialityImpact string `json:"confidentialityImpact"`
256+
IntegrityImpact string `json:"integrityImpact"`
257+
PrivilegesRequired string `json:"privilegesRequired"`
258+
Scope string `json:"scope"`
259+
UserInteraction string `json:"userInteraction"`
260+
VectorString string `json:"vectorString"`
261+
Version string `json:"version"`
262+
}
263+
206264
// Open reads and parses a given file path and returns a CSAF document
207265
// or an error if the file could not be opened or parsed.
208266
func Open(path string) (*CSAF, error) {

0 commit comments

Comments
 (0)