1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 18:15:42 +01:00

Unify camel case spelling of message tracking.

This commit is contained in:
Sascha L. Teichmann 2023-06-15 14:18:46 +02:00
parent b5d1924d3f
commit 71a3c3a13b
4 changed files with 36 additions and 36 deletions

View file

@ -67,9 +67,9 @@ type processor struct {
badWellknownMetadata topicMessages badWellknownMetadata topicMessages
badDNSPath topicMessages badDNSPath topicMessages
badDirListings topicMessages badDirListings topicMessages
badROLIEfeed topicMessages badROLIEFeed topicMessages
badROLIEservice topicMessages badROLIEService topicMessages
badROLIEcategory topicMessages badROLIECategory topicMessages
expr *util.PathEval expr *util.PathEval
} }
@ -235,9 +235,9 @@ func (p *processor) clean() {
p.badWellknownMetadata.reset() p.badWellknownMetadata.reset()
p.badDNSPath.reset() p.badDNSPath.reset()
p.badDirListings.reset() p.badDirListings.reset()
p.badROLIEfeed.reset() p.badROLIEFeed.reset()
p.badROLIEservice.reset() p.badROLIEService.reset()
p.badROLIEcategory.reset() p.badROLIECategory.reset()
p.labelChecker = nil p.labelChecker = nil
} }
@ -685,7 +685,7 @@ func (p *processor) integrity(
// Extract the tlp level of the entry // Extract the tlp level of the entry
if tlpa, err := p.expr.Eval( if tlpa, err := p.expr.Eval(
`$.document.distribution`, doc); err != nil { `$.document.distribution`, doc); err != nil {
p.badROLIEfeed.error( p.badROLIEFeed.error(
"Extracting 'tlp level' from %s failed: %v", u, err) "Extracting 'tlp level' from %s failed: %v", u, err)
} else { } else {
tlpe := extractTLP(tlpa) tlpe := extractTLP(tlpa)

View file

@ -324,15 +324,15 @@ func (r *directoryListingsReporter) report(p *processor, domain *Domain) {
// of the "Requirement" struct as a result of that. // of the "Requirement" struct as a result of that.
func (r *rolieFeedReporter) report(p *processor, domain *Domain) { func (r *rolieFeedReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain) req := r.requirement(domain)
if !p.badROLIEfeed.used() { if !p.badROLIEFeed.used() {
req.message(InfoType, "No checks on the validity of ROLIE feeds performed.") req.message(InfoType, "No checks on the validity of ROLIE feeds performed.")
return return
} }
if len(p.badROLIEfeed) == 0 { if len(p.badROLIEFeed) == 0 {
req.message(InfoType, "All checked ROLIE feeds validated fine.") req.message(InfoType, "All checked ROLIE feeds validated fine.")
return return
} }
req.Messages = p.badROLIEfeed req.Messages = p.badROLIEFeed
} }
// report tests whether a ROLIE service document is used and if so, // report tests whether a ROLIE service document is used and if so,
@ -341,15 +341,15 @@ func (r *rolieFeedReporter) report(p *processor, domain *Domain) {
// of the "Requirement" struct as a result of that. // of the "Requirement" struct as a result of that.
func (r *rolieServiceReporter) report(p *processor, domain *Domain) { func (r *rolieServiceReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain) req := r.requirement(domain)
if !p.badROLIEservice.used() { if !p.badROLIEService.used() {
req.message(InfoType, "ROLIE service document was not checked.") req.message(InfoType, "ROLIE service document was not checked.")
return return
} }
if len(p.badROLIEservice) == 0 { if len(p.badROLIEService) == 0 {
req.message(InfoType, "ROLIE service document validated fine.") req.message(InfoType, "ROLIE service document validated fine.")
return return
} }
req.Messages = p.badROLIEservice req.Messages = p.badROLIEService
} }
@ -360,15 +360,15 @@ func (r *rolieServiceReporter) report(p *processor, domain *Domain) {
// of the "Requirement" struct as a result of that. // of the "Requirement" struct as a result of that.
func (r *rolieCategoryReporter) report(p *processor, domain *Domain) { func (r *rolieCategoryReporter) report(p *processor, domain *Domain) {
req := r.requirement(domain) req := r.requirement(domain)
if !p.badROLIEcategory.used() { if !p.badROLIECategory.used() {
req.message(InfoType, "No checks on the existence of ROLIE category documents performed.") req.message(InfoType, "No checks on the existence of ROLIE category documents performed.")
return return
} }
if len(p.badROLIEcategory) == 0 { if len(p.badROLIECategory) == 0 {
req.message(InfoType, "All checked ROLIE category documents exist.") req.message(InfoType, "All checked ROLIE category documents exist.")
return return
} }
req.Messages = p.badROLIEcategory req.Messages = p.badROLIECategory
} }

View file

@ -78,11 +78,11 @@ func (ca *rolieLabelChecker) check(
switch { switch {
case advisoryRank < feedRank: case advisoryRank < feedRank:
if advisoryRank == 0 { // All kinds of 'UNLABELED' if advisoryRank == 0 { // All kinds of 'UNLABELED'
p.badROLIEfeed.info( p.badROLIEFeed.info(
"Found unlabeled advisory %q in feed %q.", "Found unlabeled advisory %q in feed %q.",
advisory, ca.feedURL) advisory, ca.feedURL)
} else { } else {
p.badROLIEfeed.warn( p.badROLIEFeed.warn(
"Found advisory %q labled TLP:%s in feed %q (TLP:%s).", "Found advisory %q labled TLP:%s in feed %q (TLP:%s).",
advisory, advisoryLabel, advisory, advisoryLabel,
ca.feedURL, ca.feedLabel) ca.feedURL, ca.feedLabel)
@ -90,7 +90,7 @@ func (ca *rolieLabelChecker) check(
case advisoryRank > feedRank: case advisoryRank > feedRank:
// Must not happen, give error // Must not happen, give error
p.badROLIEfeed.error( p.badROLIEFeed.error(
"%s of TLP level %s must not be listed in feed %s of TLP level %s", "%s of TLP level %s must not be listed in feed %s of TLP level %s",
advisory, advisoryLabel, ca.feedURL, ca.feedLabel) advisory, advisoryLabel, ca.feedURL, ca.feedLabel)
} }
@ -104,7 +104,7 @@ func (p *processor) processROLIEFeeds(feeds [][]csaf.Feed) error {
if err != nil { if err != nil {
return err return err
} }
p.badROLIEfeed.use() p.badROLIEFeed.use()
advisories := map[*csaf.Feed][]csaf.AdvisoryFile{} advisories := map[*csaf.Feed][]csaf.AdvisoryFile{}
@ -239,7 +239,7 @@ func (p *processor) processROLIEFeeds(feeds [][]csaf.Feed) error {
} }
if !hasWhite && !hasGreen && !hasUnlabeled { if !hasWhite && !hasGreen && !hasUnlabeled {
p.badROLIEfeed.error( p.badROLIEFeed.error(
"One ROLIE feed with a TLP:WHITE, TLP:GREEN or unlabeled tlp must exist, " + "One ROLIE feed with a TLP:WHITE, TLP:GREEN or unlabeled tlp must exist, " +
"but none were found.") "but none were found.")
} }
@ -253,7 +253,7 @@ func (p *processor) processROLIEFeeds(feeds [][]csaf.Feed) error {
csaf.TLPLabelRed, csaf.TLPLabelRed,
} { } {
if _, ok := hasSummary[label]; !ok && len(p.labelChecker.advisories[label]) > 0 { if _, ok := hasSummary[label]; !ok && len(p.labelChecker.advisories[label]) > 0 {
p.badROLIEfeed.warn( p.badROLIEFeed.warn(
"ROLIE feed for TLP:%s has no accessible listed feed covering all advisories.", "ROLIE feed for TLP:%s has no accessible listed feed covering all advisories.",
label) label)
} }
@ -278,15 +278,15 @@ func (p *processor) categoryCheck(folderURL string, label csaf.TLPLabel) error {
labelname := strings.ToLower(string(label)) labelname := strings.ToLower(string(label))
urlrc := folderURL + "category-" + labelname + ".json" urlrc := folderURL + "category-" + labelname + ".json"
p.badROLIEcategory.use() p.badROLIECategory.use()
client := p.httpClient() client := p.httpClient()
res, err := client.Get(urlrc) res, err := client.Get(urlrc)
if err != nil { if err != nil {
p.badROLIEcategory.error("Cannot fetch rolie category document %s: %v", urlrc, err) p.badROLIECategory.error("Cannot fetch rolie category document %s: %v", urlrc, err)
return errContinue return errContinue
} }
if res.StatusCode != http.StatusOK { if res.StatusCode != http.StatusOK {
p.badROLIEcategory.warn("Fetching %s failed. Status code %d (%s)", p.badROLIECategory.warn("Fetching %s failed. Status code %d (%s)",
urlrc, res.StatusCode, res.Status) urlrc, res.StatusCode, res.Status)
return errContinue return errContinue
} }
@ -296,11 +296,11 @@ func (p *processor) categoryCheck(folderURL string, label csaf.TLPLabel) error {
}() }()
if err != nil { if err != nil {
p.badROLIEcategory.error("Loading ROLIE category document failed: %v.", err) p.badROLIECategory.error("Loading ROLIE category document failed: %v.", err)
return errContinue return errContinue
} }
if len(rolieCategory.Categories.Category) == 0 { if len(rolieCategory.Categories.Category) == 0 {
p.badROLIEcategory.warn("No distinguishing categories in ROLIE category document: %s", urlrc) p.badROLIECategory.warn("No distinguishing categories in ROLIE category document: %s", urlrc)
} }
return nil return nil
} }
@ -320,16 +320,16 @@ func (p *processor) serviceCheck(feeds [][]csaf.Feed) error {
urls := baseURL + "service.json" urls := baseURL + "service.json"
// load service document // load service document
p.badROLIEservice.use() p.badROLIEService.use()
client := p.httpClient() client := p.httpClient()
res, err := client.Get(urls) res, err := client.Get(urls)
if err != nil { if err != nil {
p.badROLIEservice.error("Cannot fetch rolie service document %s: %v", urls, err) p.badROLIEService.error("Cannot fetch rolie service document %s: %v", urls, err)
return errContinue return errContinue
} }
if res.StatusCode != http.StatusOK { if res.StatusCode != http.StatusOK {
p.badROLIEservice.warn("Fetching %s failed. Status code %d (%s)", p.badROLIEService.warn("Fetching %s failed. Status code %d (%s)",
urls, res.StatusCode, res.Status) urls, res.StatusCode, res.Status)
return errContinue return errContinue
} }
@ -340,7 +340,7 @@ func (p *processor) serviceCheck(feeds [][]csaf.Feed) error {
}() }()
if err != nil { if err != nil {
p.badROLIEservice.error("Loading ROLIE service document failed: %v.", err) p.badROLIEService.error("Loading ROLIE service document failed: %v.", err)
return errContinue return errContinue
} }
@ -361,11 +361,11 @@ func (p *processor) serviceCheck(feeds [][]csaf.Feed) error {
// Check if ROLIE Service Document contains exactly all ROLIE feeds // Check if ROLIE Service Document contains exactly all ROLIE feeds
if m1 := sfeeds.Difference(ffeeds).Keys(); len(m1) != 0 { if m1 := sfeeds.Difference(ffeeds).Keys(); len(m1) != 0 {
sort.Strings(m1) sort.Strings(m1)
p.badROLIEservice.error("The ROLIE service document contains nonexistent feed entries: %v", m1) p.badROLIEService.error("The ROLIE service document contains nonexistent feed entries: %v", m1)
} }
if m2 := ffeeds.Difference(sfeeds).Keys(); len(m2) != 0 { if m2 := ffeeds.Difference(sfeeds).Keys(); len(m2) != 0 {
sort.Strings(m2) sort.Strings(m2)
p.badROLIEservice.error("The ROLIE service document is missing feed entries: %v", m2) p.badROLIEService.error("The ROLIE service document is missing feed entries: %v", m2)
} }
// TODO: Check conformity with RFC8322 // TODO: Check conformity with RFC8322

View file

@ -180,11 +180,11 @@ func (p *processor) eval(requirement int) bool {
return !p.badDirListings.hasErrors() return !p.badDirListings.hasErrors()
case 15: case 15:
return !p.badROLIEfeed.hasErrors() return !p.badROLIEFeed.hasErrors()
case 16: case 16:
return !p.badROLIEservice.hasErrors() return !p.badROLIEService.hasErrors()
case 17: case 17:
return !p.badROLIEcategory.hasErrors() return !p.badROLIECategory.hasErrors()
case 18: case 18:
return !p.badIntegrities.hasErrors() return !p.badIntegrities.hasErrors()