Skip to content

Commit 17fa045

Browse files
leodidoona-agent
andcommitted
fix: skip packages without SBOM during vulnerability scanning
When vulnerability scanning is enabled, packages cached before SBOM was enabled or before the external SBOM feature (v0.16.0-rc9) may not have SBOM files. Previously, this caused the build to fail with: SBOM file not found in package archive for package <name> Now, packages without SBOM files are skipped with a warning message, allowing the vulnerability scan to continue for other packages. Co-authored-by: Ona <[email protected]>
1 parent eb5e08c commit 17fa045

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/leeway/sbom-scan.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,13 @@ func scanAllPackagesForVulnerabilities(buildctx *buildContext, packages []*Packa
129129

130130
if err != nil {
131131
if err == ErrNoSBOMFile {
132-
errMsg := fmt.Sprintf("SBOM file not found in package archive for package %s", p.FullName())
133-
buildctx.Reporter.PackageBuildLog(p, true, []byte(errMsg+"\n"))
134-
return xerrors.Errorf(errMsg)
132+
// Skip packages without SBOM files - this can happen for packages
133+
// cached before SBOM was enabled or before the external SBOM feature.
134+
// Log a warning but continue scanning other packages.
135+
buildctx.Reporter.PackageBuildLog(p, false, []byte(fmt.Sprintf(
136+
"Skipping vulnerability scan for package %s: no SBOM file found (package may have been cached before SBOM was enabled)\n",
137+
p.FullName())))
138+
continue
135139
}
136140
errMsg := fmt.Sprintf("Failed to extract SBOM from package archive for package %s: %s\n", p.FullName(), err.Error())
137141
buildctx.Reporter.PackageBuildLog(p, true, []byte(errMsg+"\n"))

0 commit comments

Comments
 (0)