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:
parent
a69d35ab3c
commit
72e6df2987
2 changed files with 24 additions and 24 deletions
|
|
@ -57,8 +57,8 @@ type processor struct {
|
||||||
badIndices topicMessages
|
badIndices topicMessages
|
||||||
badChanges topicMessages
|
badChanges topicMessages
|
||||||
badFolders topicMessages
|
badFolders topicMessages
|
||||||
badWellknownMetadataReporter topicMessages
|
badWellknownMetadata topicMessages
|
||||||
badDNSPathReporter topicMessages
|
badDNSPath topicMessages
|
||||||
|
|
||||||
expr *util.PathEval
|
expr *util.PathEval
|
||||||
}
|
}
|
||||||
|
|
@ -1015,17 +1015,17 @@ func (p *processor) checkWellknownMetadataReporter(domain string) error {
|
||||||
|
|
||||||
client := p.httpClient()
|
client := p.httpClient()
|
||||||
|
|
||||||
p.badWellknownMetadataReporter.use()
|
p.badWellknownMetadata.use()
|
||||||
|
|
||||||
path := "https://" + domain + "/.well-known/csaf/provider-metadata.json"
|
path := "https://" + domain + "/.well-known/csaf/provider-metadata.json"
|
||||||
|
|
||||||
res, err := client.Get(path)
|
res, err := client.Get(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.badWellknownMetadataReporter.add("Fetiching %s failed: %v", path, err)
|
p.badWellknownMetadata.add("Fetiching %s failed: %v", path, err)
|
||||||
return errContinue
|
return errContinue
|
||||||
}
|
}
|
||||||
if res.StatusCode != http.StatusOK {
|
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)
|
path, res.StatusCode, res.Status)
|
||||||
return errContinue
|
return errContinue
|
||||||
}
|
}
|
||||||
|
|
@ -1040,16 +1040,16 @@ func (p *processor) checkDNSPathReporter(domain string) error {
|
||||||
|
|
||||||
client := p.httpClient()
|
client := p.httpClient()
|
||||||
|
|
||||||
p.badDNSPathReporter.use()
|
p.badDNSPath.use()
|
||||||
|
|
||||||
path := "https://csaf.data.security.domain.tld"
|
path := "https://csaf.data.security.domain.tld"
|
||||||
res, err := client.Get(path)
|
res, err := client.Get(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.badDNSPathReporter.add("Fetiching %s failed: %v", path, err)
|
p.badDNSPath.add("Fetiching %s failed: %v", path, err)
|
||||||
return errContinue
|
return errContinue
|
||||||
}
|
}
|
||||||
if res.StatusCode != http.StatusOK {
|
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)
|
path, res.StatusCode, res.Status)
|
||||||
return errContinue
|
return errContinue
|
||||||
}
|
}
|
||||||
|
|
@ -1057,12 +1057,12 @@ func (p *processor) checkDNSPathReporter(domain string) error {
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
content, err := io.ReadAll(res.Body)
|
content, err := io.ReadAll(res.Body)
|
||||||
if err != nil {
|
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
|
return errContinue
|
||||||
}
|
}
|
||||||
hash.Write(content)
|
hash.Write(content)
|
||||||
if !bytes.Equal(hash.Sum(nil), p.pmd256) {
|
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
|
return errContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.
|
//report tests the availability of the "provider-metadata.json" under /.well-known/csaf/ directoy.
|
||||||
func (r *wellknownMetadataReporter) report(p *processor, domain *Domain) {
|
func (r *wellknownMetadataReporter) report(p *processor, domain *Domain) {
|
||||||
req := r.requirement(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.")
|
req.message("No check if provider-metadata.json is under /.well-known/csaf/ was done.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(p.badWellknownMetadataReporter) == 0 {
|
if len(p.badWellknownMetadata) == 0 {
|
||||||
req.message("Found /.well-known/csaf/provider-metadata.json")
|
req.message("Found /.well-known/csaf/provider-metadata.json")
|
||||||
return
|
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"
|
// 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) {
|
func (r *dnsPathReporter) report(p *processor, domain *Domain) {
|
||||||
req := r.requirement(domain)
|
req := r.requirement(domain)
|
||||||
if !p.badDNSPathReporter.used() {
|
if !p.badDNSPath.used() {
|
||||||
req.message("No csaf.data.security.domain.tld DNS record checked.")
|
req.message("No csaf.data.security.domain.tld DNS record checked.")
|
||||||
return
|
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.")
|
req.message("csaf.data.security.domain.tld DNS record is available and serves the provider-metadata.json.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
req.Messages = p.badDNSPathReporter
|
req.Messages = p.badDNSPath
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *oneFolderPerYearReport) report(p *processor, domain *Domain) {
|
func (r *oneFolderPerYearReport) report(p *processor, domain *Domain) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue