mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
check each advisory is listable
This commit is contained in:
parent
131a7155fa
commit
16556cd8bb
2 changed files with 77 additions and 85 deletions
|
|
@ -204,6 +204,7 @@ func (p *processor) checkDomain(domain string) error {
|
|||
(*processor).checkSecurity,
|
||||
(*processor).checkCSAFs,
|
||||
(*processor).checkMissing,
|
||||
(*processor).checkListing,
|
||||
(*processor).checkWellknownMetadataReporter,
|
||||
(*processor).checkDNSPathReporter,
|
||||
} {
|
||||
|
|
@ -517,10 +518,6 @@ func (p *processor) processROLIEFeed(feed string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := p.checkListing(base, rolieListingMask); err != nil && err != errContinue {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -690,21 +687,6 @@ func (p *processor) checkCSAFs(domain string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := p.checkListing(base, listingMask); err != nil && err != errContinue {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *processor) checkListing(base string, mask whereType) error {
|
||||
links, err := p.linksOnPageURL(base)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, link := range links {
|
||||
p.markChecked(link, mask)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -742,6 +724,35 @@ func (p *processor) checkMissing(string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// checkListing wents over all found adivisories URLs and checks,
|
||||
// if their parent directory is listable.
|
||||
func (p *processor) checkListing(string) error {
|
||||
|
||||
p.badDirListings.use()
|
||||
|
||||
pgs := pages{}
|
||||
|
||||
var unlisted []string
|
||||
|
||||
for f := range p.alreadyChecked {
|
||||
found, err := pgs.listed(f, p)
|
||||
if err != nil && err != errContinue {
|
||||
return err
|
||||
}
|
||||
if !found {
|
||||
unlisted = append(unlisted, f)
|
||||
}
|
||||
}
|
||||
|
||||
if len(unlisted) > 0 {
|
||||
sort.Strings(unlisted)
|
||||
p.badDirListings.add("Not listed advisories: %s",
|
||||
strings.Join(unlisted, ", "))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var providerMetadataLocations = [...]string{
|
||||
".well-known/csaf",
|
||||
"security/data/csaf",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue