Description
Scorecard utilizes osvscanner.DoScan
when performing its Vulnerabilities
check. The time to complete the check is more than an order of magnitude higher than other checks. Running pprof
shows a hot spot in scanSBOMFile
.
It looks like when walking a directory, every file is potentially parsed as an SBOM:
osv-scanner/pkg/osvscanner/osvscanner.go
Lines 114 to 117 in 6eab450
There are currently two providers, SPDX and CycloneDX. While SPDX checks for a filename, there's no such check for CycloneDX:
osv-scanner/pkg/osvscanner/osvscanner.go
Lines 231 to 238 in 6eab450
I believe this means attempting to parse every file as a CycloneDX SBOM, twice. In large repositories, this adds up ( longest observed is 5 minutes) :
osv-scanner/internal/sbom/cyclonedx.go
Lines 50 to 59 in 6eab450