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

Rename some variables

This commit is contained in:
Fadi Abbud 2022-05-04 15:39:22 +02:00
parent a69d35ab3c
commit 72e6df2987
2 changed files with 24 additions and 24 deletions

View file

@ -57,8 +57,8 @@ type processor struct {
badIndices topicMessages
badChanges topicMessages
badFolders topicMessages
badWellknownMetadataReporter topicMessages
badDNSPathReporter 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
}

View file

@ -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) {