mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Improve writing ROLIE feed documents
* Add signature and two time has as link rel attributes to each rolie entry for provider and aggregator. Thus following CSAF 2.0 csd02. resolve #74
This commit is contained in:
parent
22b945a3c3
commit
589547fa94
5 changed files with 18 additions and 12 deletions
|
|
@ -166,10 +166,12 @@ func (w *worker) writeROLIE(label string, summaries []summary) error {
|
||||||
Titel: s.summary.Title,
|
Titel: s.summary.Title,
|
||||||
Published: csaf.TimeStamp(s.summary.InitialReleaseDate),
|
Published: csaf.TimeStamp(s.summary.InitialReleaseDate),
|
||||||
Updated: csaf.TimeStamp(s.summary.CurrentReleaseDate),
|
Updated: csaf.TimeStamp(s.summary.CurrentReleaseDate),
|
||||||
Link: []csaf.Link{{
|
Link: []csaf.Link{
|
||||||
Rel: "self",
|
{Rel: "self", HRef: csafURL},
|
||||||
HRef: csafURL,
|
{Rel: "hash", HRef: csafURL + ".sha256"},
|
||||||
}},
|
{Rel: "hash", HRef: csafURL + ".sha512"},
|
||||||
|
{Rel: "signature", HRef: csafURL + ".asc"},
|
||||||
|
},
|
||||||
Format: format,
|
Format: format,
|
||||||
Content: csaf.Content{
|
Content: csaf.Content{
|
||||||
Type: "application/json",
|
Type: "application/json",
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ func (w *worker) handleROLIE(
|
||||||
log.Printf("Loading ROLIE feed failed: %v.", err)
|
log.Printf("Loading ROLIE feed failed: %v.", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
files := resolveURLs(rfeed.Files(), feedBaseURL)
|
files := resolveURLs(rfeed.Files("self"), feedBaseURL)
|
||||||
if err := process(feed.TLPLabel, files); err != nil {
|
if err := process(feed.TLPLabel, files); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -545,7 +545,7 @@ func (p *processor) processROLIEFeed(feed string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract the CSAF files from feed.
|
// Extract the CSAF files from feed.
|
||||||
files := rfeed.Files()
|
files := rfeed.Files("self")
|
||||||
|
|
||||||
if err := p.integrity(files, base, rolieMask, p.badProviderMetadata.add); err != nil &&
|
if err := p.integrity(files, base, rolieMask, p.badProviderMetadata.add); err != nil &&
|
||||||
err != errContinue {
|
err != errContinue {
|
||||||
|
|
|
||||||
|
|
@ -255,10 +255,12 @@ func (c *controller) upload(r *http.Request) (interface{}, error) {
|
||||||
e.Titel = ex.Title
|
e.Titel = ex.Title
|
||||||
e.Published = csaf.TimeStamp(ex.InitialReleaseDate)
|
e.Published = csaf.TimeStamp(ex.InitialReleaseDate)
|
||||||
e.Updated = csaf.TimeStamp(ex.CurrentReleaseDate)
|
e.Updated = csaf.TimeStamp(ex.CurrentReleaseDate)
|
||||||
e.Link = []csaf.Link{{
|
e.Link = []csaf.Link{
|
||||||
Rel: "self",
|
{Rel: "self", HRef: csafURL},
|
||||||
HRef: csafURL,
|
{Rel: "hash", HRef: csafURL + ".sha256"},
|
||||||
}}
|
{Rel: "hash", HRef: csafURL + ".sha512"},
|
||||||
|
{Rel: "signature", HRef: csafURL + ".asc"},
|
||||||
|
}
|
||||||
e.Format = csaf.Format{
|
e.Format = csaf.Format{
|
||||||
Schema: "https://docs.oasis-open.org/csaf/csaf/v2.0/csaf_json_schema.json",
|
Schema: "https://docs.oasis-open.org/csaf/csaf/v2.0/csaf_json_schema.json",
|
||||||
Version: "2.0",
|
Version: "2.0",
|
||||||
|
|
|
||||||
|
|
@ -104,11 +104,13 @@ func (rf *ROLIEFeed) EntryByID(id string) *Entry {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Files extracts the files from the feed.
|
// Files extracts the files from the feed.
|
||||||
func (rf *ROLIEFeed) Files() []string {
|
func (rf *ROLIEFeed) Files(filter string) []string {
|
||||||
var files []string
|
var files []string
|
||||||
for _, f := range rf.Feed.Entry {
|
for _, f := range rf.Feed.Entry {
|
||||||
for i := range f.Link {
|
for i := range f.Link {
|
||||||
files = append(files, f.Link[i].HRef)
|
if link := &f.Link[i]; link.Rel == filter {
|
||||||
|
files = append(files, link.HRef)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return files
|
return files
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue