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

Make rolie or directory listing mandatory (#409)

* Changed infos to warnings and errors for Requirements 11-17 if said Requirements were not checked.

* Made a few more infos to warnings, slightly improved some messages in the reporters.

* Add explicite errors if badROLIEFeed and badFolders were not used.

---------

Co-authored-by: JanHoefelmeyer <hoefelmeyer.jan@gmail.com>
This commit is contained in:
JanHoefelmeyer 2023-08-19 10:59:37 +02:00 committed by GitHub
parent 824079899e
commit 5c935901ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 15 deletions

View file

@ -879,7 +879,7 @@ func (p *processor) checkIndex(base string, mask whereType) error {
p.badIndices.error("Fetching %s failed. Status code %d (%s)",
index, res.StatusCode, res.Status)
} else {
p.badIndices.warn("Fetching index.txt failed: %v not found.", index)
p.badIndices.error("Fetching index.txt failed: %v not found.", index)
}
return errContinue
}
@ -942,7 +942,7 @@ func (p *processor) checkChanges(base string, mask whereType) error {
p.badChanges.error("Fetching %s failed. Status code %d (%s)",
changes, res.StatusCode, res.Status)
} else {
p.badChanges.warn("Fetching changes.csv failed: %v not found.", changes)
p.badChanges.error("Fetching changes.csv failed: %v not found.", changes)
}
return errContinue
}
@ -1039,6 +1039,13 @@ func (p *processor) checkCSAFs(_ string) error {
}
// check for service category document
p.serviceCheck(feeds)
} else {
p.badROLIEFeed.use()
p.badROLIEFeed.error("ROLIE feed based distribution was not used.")
p.badROLIECategory.use()
p.badROLIECategory.warn("No ROLIE category document found.")
p.badROLIEService.use()
p.badROLIEService.warn("No ROLIE service document found.")
}
// No rolie feeds -> try directory_urls.
@ -1083,6 +1090,10 @@ func (p *processor) checkCSAFs(_ string) error {
}
}
if !p.badFolders.used() {
p.badFolders.use()
p.badFolders.error("No checks performed on whether files are within the right folders.")
}
return nil
}

View file

@ -288,10 +288,6 @@ func (r *dnsPathReporter) report(p *processor, domain *Domain) {
func (r *oneFolderPerYearReport) report(p *processor, domain *Domain) {
req := r.requirement(domain)
if !p.badFolders.used() {
req.message(InfoType, "No checks if files are in right folders were performed.")
return
}
if len(p.badFolders) == 0 {
req.message(InfoType, "All CSAF files are in the right folders.")
return
@ -302,7 +298,7 @@ func (r *oneFolderPerYearReport) report(p *processor, domain *Domain) {
func (r *indexReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain)
if !p.badIndices.used() {
req.message(InfoType, "No index.txt checked.")
req.message(ErrorType, "No index.txt checked.")
return
}
if len(p.badIndices) == 0 {
@ -315,7 +311,7 @@ func (r *indexReporter) report(p *processor, domain *Domain) {
func (r *changesReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain)
if !p.badChanges.used() {
req.message(InfoType, "No changes.csv checked.")
req.message(ErrorType, "No changes.csv checked.")
return
}
if len(p.badChanges) == 0 {
@ -328,7 +324,7 @@ func (r *changesReporter) report(p *processor, domain *Domain) {
func (r *directoryListingsReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain)
if !p.badDirListings.used() {
req.message(InfoType, "No directory listings checked.")
req.message(WarnType, "No directory listings checked.")
return
}
if len(p.badDirListings) == 0 {
@ -344,10 +340,6 @@ func (r *directoryListingsReporter) report(p *processor, domain *Domain) {
// of the "Requirement" struct as a result of that.
func (r *rolieFeedReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain)
if !p.badROLIEFeed.used() {
req.message(InfoType, "No checks on the validity of ROLIE feeds performed.")
return
}
if len(p.badROLIEFeed) == 0 {
req.message(InfoType, "All checked ROLIE feeds validated fine.")
return
@ -362,7 +354,7 @@ func (r *rolieFeedReporter) report(p *processor, domain *Domain) {
func (r *rolieServiceReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain)
if !p.badROLIEService.used() {
req.message(InfoType, "ROLIE service document was not checked.")
req.message(WarnType, "ROLIE service document was not checked.")
return
}
if len(p.badROLIEService) == 0 {
@ -381,7 +373,7 @@ func (r *rolieServiceReporter) report(p *processor, domain *Domain) {
func (r *rolieCategoryReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain)
if !p.badROLIECategory.used() {
req.message(InfoType, "No checks on the existence of ROLIE category documents performed.")
req.message(WarnType, "No checks on the existence of ROLIE category documents performed.")
return
}
if len(p.badROLIECategory) == 0 {