Skip to content

Commit

Permalink
feat(spec1-5): add support for vulnerability rejected timestamps
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed Dec 7, 2023
1 parent 55ff321 commit 25b250a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ func (b *BOM) convert(specVersion SpecVersion) {
}
}

if b.Vulnerabilities != nil {
for i := range *b.Vulnerabilities {
if specVersion < SpecVersion1_5 {
(*b.Vulnerabilities)[i].Rejected = ""
}
}
}

b.SpecVersion = specVersion
b.XMLNS = xmlNamespaces[specVersion]
b.JSONSchema = jsonSchemas[specVersion]
Expand Down
1 change: 1 addition & 0 deletions cyclonedx.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ type Vulnerability struct {
Created string `json:"created,omitempty" xml:"created,omitempty"`
Published string `json:"published,omitempty" xml:"published,omitempty"`
Updated string `json:"updated,omitempty" xml:"updated,omitempty"`
Rejected string `json:"rejected,omitempty" xml:"rejected,omitempty"`
Credits *Credits `json:"credits,omitempty" xml:"credits,omitempty"`
Tools *[]Tool `json:"tools,omitempty" xml:"tools>tool,omitempty"`
Analysis *VulnerabilityAnalysis `json:"analysis,omitempty" xml:"analysis,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"created": "2021-01-01T00:00:00.000Z",
"published": "2021-01-01T00:00:00.000Z",
"updated": "2021-01-01T00:00:00.000Z",
"rejected": "2022-01-01T00:00:00.000Z",
"credits": {
"organizations": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<created>2021-01-01T00:00:00.000Z</created>
<published>2021-01-01T00:00:00.000Z</published>
<updated>2021-01-01T00:00:00.000Z</updated>
<rejected>2022-01-01T00:00:00.000Z</rejected>
<credits>
<organizations>
<organization>
Expand Down
1 change: 1 addition & 0 deletions testdata/valid-vulnerability.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"created": "2021-01-01T00:00:00.000Z",
"published": "2021-01-01T00:00:00.000Z",
"updated": "2021-01-01T00:00:00.000Z",
"rejected": "2022-01-01T00:00:00.000Z",
"credits": {
"organizations": [
{
Expand Down
1 change: 1 addition & 0 deletions testdata/valid-vulnerability.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<created>2021-01-01T00:00:00.000Z</created>
<published>2021-01-01T00:00:00.000Z</published>
<updated>2021-01-01T00:00:00.000Z</updated>
<rejected>2022-01-01T00:00:00.000Z</rejected>
<credits>
<organizations>
<organization>
Expand Down

0 comments on commit 25b250a

Please sign in to comment.