diff --git a/cyclonedx.go b/cyclonedx.go index a265ef2..73f4809 100644 --- a/cyclonedx.go +++ b/cyclonedx.go @@ -626,6 +626,7 @@ type Vulnerability struct { Tools *[]Tool `json:"tools,omitempty" xml:"tools>tool,omitempty"` Analysis *VulnerabilityAnalysis `json:"analysis,omitempty" xml:"analysis,omitempty"` Affects *[]Affects `json:"affects,omitempty" xml:"affects>target,omitempty"` + Properties *[]Property `json:"properties,omitempty" xml:"properties>property,omitempty"` } type VulnerabilityAnalysis struct { diff --git a/cyclonedx_test.go b/cyclonedx_test.go index 3ced188..dd24ac1 100644 --- a/cyclonedx_test.go +++ b/cyclonedx_test.go @@ -217,3 +217,14 @@ func TestLicenses_UnmarshalXML(t *testing.T) { err = xml.Unmarshal([]byte("expressionValue"), licenses) assert.Error(t, err) } + +func TestVulnerability_Properties(t *testing.T) { + // GIVEN + properties := []Property{} + vuln := Vulnerability{ + Properties: &properties, + } + + // EXPECT + assert.Equal(t, 0, len(*vuln.Properties)) +} diff --git a/testdata/snapshots/cyclonedx-go-TestRoundTripJSON-func1-valid-vulnerability.json b/testdata/snapshots/cyclonedx-go-TestRoundTripJSON-func1-valid-vulnerability.json index 4062fe4..9258923 100644 --- a/testdata/snapshots/cyclonedx-go-TestRoundTripJSON-func1-valid-vulnerability.json +++ b/testdata/snapshots/cyclonedx-go-TestRoundTripJSON-func1-valid-vulnerability.json @@ -118,6 +118,24 @@ } ] } + ], + "properties": [ + { + "name": "Foo", + "value": "Bar" + }, + { + "name": "Foo", + "value": "You" + }, + { + "name": "Foo", + "value": "Two" + }, + { + "name": "Bar", + "value": "Foo" + } ] } ] diff --git a/testdata/valid-vulnerability.json b/testdata/valid-vulnerability.json index c4065f6..701152f 100644 --- a/testdata/valid-vulnerability.json +++ b/testdata/valid-vulnerability.json @@ -116,6 +116,24 @@ } ] } + ], + "properties": [ + { + "name": "Foo", + "value": "Bar" + }, + { + "name": "Foo", + "value": "You" + }, + { + "name": "Foo", + "value": "Two" + }, + { + "name": "Bar", + "value": "Foo" + } ] } ] diff --git a/testdata/valid-vulnerability.xml b/testdata/valid-vulnerability.xml index 46b4448..cb6ad19 100644 --- a/testdata/valid-vulnerability.xml +++ b/testdata/valid-vulnerability.xml @@ -116,6 +116,12 @@ +