Skip to content

Commit

Permalink
csaf: add status to the document.tracking
Browse files Browse the repository at this point in the history
Adding the status field to be able to reason with whether the advisory
has been deleted.

Signed-off-by: crozzy <[email protected]>
  • Loading branch information
crozzy committed May 28, 2024
1 parent a589d68 commit 2e766ce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions toolkit/types/csaf/csaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type Tracking struct {
ID string `json:"id"`
CurrentReleaseDate time.Time `json:"current_release_date"`
InitialReleaseDate time.Time `json:"initial_release_date"`
Status string `json:"status"`
}

// Publisher provides information on the publishing entity.
Expand Down
7 changes: 7 additions & 0 deletions toolkit/types/csaf/csaf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ var testBattery = []struct {
},
},
},
{
path: "testdata/cve-1999-0001-deleted.json",
},
}

func TestAll(t *testing.T) {
Expand All @@ -131,6 +134,10 @@ func TestAll(t *testing.T) {
if err != nil {
t.Fatalf("failed to parse CSAF JSON: %v", err)
}
if c.Document.Tracking.Status == "deleted" {
t.Log("advisory deleted", c.Document.Tracking.ID)
return
}
if got := c.ProductTree.FindProductByID(tc.product.ID); !cmp.Equal(tc.product, got) {
t.Error(cmp.Diff(tc.product, got))
}
Expand Down
1 change: 1 addition & 0 deletions toolkit/types/csaf/testdata/cve-1999-0001-deleted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"document":{"tracking":{"id":"CVE-2023-0118","status":"deleted"}}}

0 comments on commit 2e766ce

Please sign in to comment.