mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Improve hash path handling of directory feeds
This commit is contained in:
parent
a131b0fb4b
commit
be2e4e7424
3 changed files with 52 additions and 60 deletions
|
|
@ -895,15 +895,7 @@ func (p *processor) checkIndex(base string, mask whereType) error {
|
|||
continue
|
||||
}
|
||||
|
||||
SHA256 := p.checkURL(u + ".sha256")
|
||||
SHA512 := p.checkURL(u + ".sha512")
|
||||
sign := p.checkURL(u + ".asc")
|
||||
files = append(files, csaf.PlainAdvisoryFile{
|
||||
Path: u,
|
||||
SHA256: SHA256,
|
||||
SHA512: SHA512,
|
||||
Sign: sign,
|
||||
})
|
||||
files = append(files, csaf.DirectoryAdvisoryFile{Path: u})
|
||||
}
|
||||
return files, scanner.Err()
|
||||
}()
|
||||
|
|
@ -921,15 +913,6 @@ func (p *processor) checkIndex(base string, mask whereType) error {
|
|||
return p.integrity(files, base, mask, p.badIndices.add)
|
||||
}
|
||||
|
||||
// checkURL returns the URL if it is accessible.
|
||||
func (p *processor) checkURL(url string) string {
|
||||
_, err := p.client.Head(url)
|
||||
if err != nil {
|
||||
return url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// checkChanges fetches the "changes.csv" and calls the "checkTLS" method for HTTPs checks.
|
||||
// It extracts the file content, tests the column number and the validity of the time format
|
||||
// of the fields' values and if they are sorted properly. Then it passes the files to the
|
||||
|
|
@ -995,13 +978,9 @@ func (p *processor) checkChanges(base string, mask whereType) error {
|
|||
}
|
||||
path := r[pathColumn]
|
||||
|
||||
SHA256 := p.checkURL(path + ".sha256")
|
||||
SHA512 := p.checkURL(path + ".sha512")
|
||||
sign := p.checkURL(path + ".asc")
|
||||
|
||||
times, files =
|
||||
append(times, t),
|
||||
append(files, csaf.PlainAdvisoryFile{Path: path, SHA256: SHA256, SHA512: SHA512, Sign: sign})
|
||||
append(files, csaf.DirectoryAdvisoryFile{Path: path})
|
||||
}
|
||||
return times, files, nil
|
||||
}()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue