1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-23 00:32:55 +01:00

Fixed problems with ROLIE in provider metadata.

This commit is contained in:
Sascha L. Teichmann 2021-12-13 02:08:32 +01:00
parent 05300ff1bb
commit cd68a86a85

View file

@ -64,8 +64,8 @@ type ROLIE struct {
// Distribution is a distribution of a CSAF feed.
type Distribution struct {
DirectoryURL string `json:"directory_url,omitempty"`
Rolie []ROLIE `json:"rolie"`
DirectoryURL string `json:"directory_url,omitempty"`
Rolie *ROLIE `json:"rolie,omitempty"`
}
// TimeStamp represents a time stamp in a CSAF feed.
@ -346,9 +346,9 @@ func (pk *PGPKey) Validate() error {
// Validate checks if the distribution is valid.
// Returns an error if the validation fails otherwise nil.
func (d *Distribution) Validate() error {
for i := range d.Rolie {
if err := d.Rolie[i].Validate(); err != nil {
return nil
if d.Rolie != nil {
if err := d.Rolie.Validate(); err != nil {
return err
}
}
return nil
@ -441,6 +441,7 @@ func NewProviderMetadataDomain(domain string, tlps []TLPLabel) *ProviderMetadata
feed := "csaf-feed-tlp-" + lt + ".json"
url := JSONURL(domain + "/.well-known/csaf/" + lt + "/" + feed)
t := t
feeds[i] = Feed{
Summary: "TLP:" + string(t) + " advisories",
TLPLabel: &t,
@ -449,9 +450,9 @@ func NewProviderMetadataDomain(domain string, tlps []TLPLabel) *ProviderMetadata
}
pm.Distributions = []Distribution{{
Rolie: []ROLIE{{
Rolie: &ROLIE{
Feeds: feeds,
}},
},
}}
return pm