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

Fix: Check changes before stopping the scan of already tested advisories

This commit is contained in:
JanHoefelmeyer 2025-03-12 17:05:52 +01:00
parent 9e758507a3
commit d38dc285cc

View file

@ -651,23 +651,6 @@ func (p *processor) integrity(
continue continue
} }
if p.markChecked(u, mask) {
continue
}
p.checkTLS(u)
// Check if the filename is conforming.
p.badFilenames.use()
if !util.ConformingFileName(filepath.Base(u)) {
p.badFilenames.error("%s does not have a conforming filename.", u)
}
var folderYear *int
if m := yearFromURL.FindStringSubmatch(u); m != nil {
year, _ := strconv.Atoi(m[1])
folderYear = &year
}
res, err := client.Get(u) res, err := client.Get(u)
if err != nil { if err != nil {
lg(ErrorType, "Fetching %s failed: %v.", u, err) lg(ErrorType, "Fetching %s failed: %v.", u, err)
@ -702,6 +685,32 @@ func (p *processor) integrity(
continue continue
} }
if len(p.times) > 0 && p.badChanges.used() {
current, fault := p.extractTime(doc, `current_release_date`, u)
if fault != "" {
p.badChanges.error(fault)
} else if t, ok := p.times[f.URL()]; !ok || !current.Equal(t) {
p.badChanges.error("Current release date in changes.csv and %s is not identical", u)
}
}
if p.markChecked(u, mask) {
continue
}
p.checkTLS(u)
// Check if the filename is conforming.
p.badFilenames.use()
if !util.ConformingFileName(filepath.Base(u)) {
p.badFilenames.error("%s does not have a conforming filename.", u)
}
var folderYear *int
if m := yearFromURL.FindStringSubmatch(u); m != nil {
year, _ := strconv.Atoi(m[1])
folderYear = &year
}
p.invalidAdvisories.use() p.invalidAdvisories.use()
// Validate against JSON schema. // Validate against JSON schema.
@ -741,14 +750,6 @@ func (p *processor) integrity(
case date.UTC().Year() != *folderYear: case date.UTC().Year() != *folderYear:
p.badFolders.error("%s should be in folder %d", u, date.UTC().Year()) p.badFolders.error("%s should be in folder %d", u, date.UTC().Year())
} }
if len(p.times) > 0 && p.badChanges.used() {
current, fault := p.extractTime(doc, `current_release_date`, u)
if fault != "" {
p.badChanges.error(fault)
} else if t, ok := p.times[f.URL()]; !ok || !current.Equal(t) {
p.badChanges.error("Current release date in changes.csv and %s is not identical", u)
}
}
// Check hashes // Check hashes
p.badIntegrities.use() p.badIntegrities.use()