diff --git a/cmd/csaf_checker/processor.go b/cmd/csaf_checker/processor.go index fa873fa..9e398a4 100644 --- a/cmd/csaf_checker/processor.go +++ b/cmd/csaf_checker/processor.go @@ -49,16 +49,16 @@ type processor struct { pmd interface{} keys []*crypto.KeyRing - badIntegrities topicMessages - badPGPs topicMessages - badSignatures topicMessages - badProviderMetadata topicMessages - badSecurity topicMessages - badIndices topicMessages - badChanges topicMessages - badFolders topicMessages - badWellknownMetadataReporter topicMessages - badDNSPathReporter topicMessages + badIntegrities topicMessages + badPGPs topicMessages + badSignatures topicMessages + badProviderMetadata topicMessages + badSecurity topicMessages + badIndices topicMessages + badChanges topicMessages + badFolders topicMessages + badWellknownMetadata topicMessages + badDNSPath topicMessages expr *util.PathEval } @@ -1015,17 +1015,17 @@ func (p *processor) checkWellknownMetadataReporter(domain string) error { client := p.httpClient() - p.badWellknownMetadataReporter.use() + p.badWellknownMetadata.use() path := "https://" + domain + "/.well-known/csaf/provider-metadata.json" res, err := client.Get(path) if err != nil { - p.badWellknownMetadataReporter.add("Fetiching %s failed: %v", path, err) + p.badWellknownMetadata.add("Fetiching %s failed: %v", path, err) return errContinue } if res.StatusCode != http.StatusOK { - p.badWellknownMetadataReporter.add("Fetching %s failed. Status code %d (%s)", + p.badWellknownMetadata.add("Fetching %s failed. Status code %d (%s)", path, res.StatusCode, res.Status) return errContinue } @@ -1040,16 +1040,16 @@ func (p *processor) checkDNSPathReporter(domain string) error { client := p.httpClient() - p.badDNSPathReporter.use() + p.badDNSPath.use() path := "https://csaf.data.security.domain.tld" res, err := client.Get(path) if err != nil { - p.badDNSPathReporter.add("Fetiching %s failed: %v", path, err) + p.badDNSPath.add("Fetiching %s failed: %v", path, err) return errContinue } if res.StatusCode != http.StatusOK { - p.badDNSPathReporter.add("Fetching %s failed. Status code %d (%s)", + p.badDNSPath.add("Fetching %s failed. Status code %d (%s)", path, res.StatusCode, res.Status) return errContinue } @@ -1057,12 +1057,12 @@ func (p *processor) checkDNSPathReporter(domain string) error { defer res.Body.Close() content, err := io.ReadAll(res.Body) if err != nil { - p.badDNSPathReporter.add("Error while reading the response form %s", path) + p.badDNSPath.add("Error while reading the response form %s", path) return errContinue } hash.Write(content) if !bytes.Equal(hash.Sum(nil), p.pmd256) { - p.badDNSPathReporter.add("The csaf.data.security.domain.tld DNS record does not serve the provider-metatdata.json") + p.badDNSPath.add("The csaf.data.security.domain.tld DNS record does not serve the provider-metatdata.json") return errContinue } diff --git a/cmd/csaf_checker/reporters.go b/cmd/csaf_checker/reporters.go index cf79f3e..6abd5eb 100644 --- a/cmd/csaf_checker/reporters.go +++ b/cmd/csaf_checker/reporters.go @@ -122,29 +122,29 @@ func (r *securityReporter) report(p *processor, domain *Domain) { //report tests the availability of the "provider-metadata.json" under /.well-known/csaf/ directoy. func (r *wellknownMetadataReporter) report(p *processor, domain *Domain) { req := r.requirement(domain) - if !p.badWellknownMetadataReporter.used() { + if !p.badWellknownMetadata.used() { req.message("No check if provider-metadata.json is under /.well-known/csaf/ was done.") return } - if len(p.badWellknownMetadataReporter) == 0 { + if len(p.badWellknownMetadata) == 0 { req.message("Found /.well-known/csaf/provider-metadata.json") return } - req.Messages = p.badWellknownMetadataReporter + req.Messages = p.badWellknownMetadata } // report tests if the "csaf.data.security.domain.tld" DNS record available and serves the "provider-metadata.json" func (r *dnsPathReporter) report(p *processor, domain *Domain) { req := r.requirement(domain) - if !p.badDNSPathReporter.used() { + if !p.badDNSPath.used() { req.message("No csaf.data.security.domain.tld DNS record checked.") return } - if len(p.badDNSPathReporter) == 0 { + if len(p.badDNSPath) == 0 { req.message("csaf.data.security.domain.tld DNS record is available and serves the provider-metadata.json.") return } - req.Messages = p.badDNSPathReporter + req.Messages = p.badDNSPath } func (r *oneFolderPerYearReport) report(p *processor, domain *Domain) {