Skip to content

Commit 30e0910

Browse files
committed
Add support for CSAF 2.0 Publisher
Signed-off-by: mrizzi <[email protected]>
1 parent 457f183 commit 30e0910

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

pkg/csaf/csaf.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type DocumentMetadata struct {
3838
Title string `json:"title"`
3939
Tracking Tracking `json:"tracking"`
4040
References []Reference `json:"references"`
41+
Publisher Publisher `json:"publisher"`
4142
}
4243

4344
// Document references holds a list of references associated with the whole document.
@@ -58,6 +59,17 @@ type Tracking struct {
5859
InitialReleaseDate time.Time `json:"initial_release_date"`
5960
}
6061

62+
// Publisher provides information on the publishing entity.
63+
//
64+
// https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html#3218-document-property---publisher
65+
type Publisher struct {
66+
Category string `json:"category"`
67+
ContactDetails string `json:"contact_details"`
68+
IssuingAuthority string `json:"issuing_authority"`
69+
Name string `json:"name"`
70+
Namespace string `json:"namespace"`
71+
}
72+
6173
// Vulnerability contains information about a CVE and its associated threats.
6274
//
6375
// https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html#323-vulnerabilities-property

pkg/csaf/csaf_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ func TestOpenRHAdvisory(t *testing.T) {
3434
require.Equal(t, "AppStream-8.1.0.Z.MAIN.EUS", doc.FirstProductName())
3535

3636
require.Equal(t, "https://bugzilla.redhat.com/show_bug.cgi?id=1794290", doc.Vulnerabilities[0].IDs[0].Text)
37+
38+
// Publisher
39+
require.Equal(t, doc.Document.Publisher.Category, "vendor")
40+
require.Equal(t, doc.Document.Publisher.ContactDetails, "https://access.redhat.com/security/team/contact/")
41+
require.Equal(t, doc.Document.Publisher.IssuingAuthority, "Red Hat Product Security is responsible for vulnerability handling across all Red Hat offerings.")
42+
require.Equal(t, doc.Document.Publisher.Name, "Red Hat Product Security")
43+
require.Equal(t, doc.Document.Publisher.Namespace, "https://www.redhat.com")
3744
}
3845

3946
func TestFindFirstProduct(t *testing.T) {

0 commit comments

Comments
 (0)