Skip to content

Commit

Permalink
fix(scanner): scan results of SBOMs generated from container images a…
Browse files Browse the repository at this point in the history
…re missing layers

Signed-off-by: Fabrizio Sestito <[email protected]>
  • Loading branch information
fabriziosestito committed Oct 2, 2024
1 parent 3e1fa21 commit 0205c55
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions pkg/scanner/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ func (s Scanner) ScanArtifact(ctx context.Context, options types.ScanOptions) (t
ptros = nil
}

// Layer makes sense only when scanning container images
if artifactInfo.Type != artifact.TypeContainerImage {
removeLayer(results)
}

return types.Report{
SchemaVersion: report.SchemaVersion,
CreatedAt: clock.Now(ctx),
Expand All @@ -202,19 +197,3 @@ func (s Scanner) ScanArtifact(ctx context.Context, options types.ScanOptions) (t
BOM: artifactInfo.BOM,
}, nil
}

func removeLayer(results types.Results) {
for i := range results {
result := results[i]

for j := range result.Packages {
result.Packages[j].Layer = ftypes.Layer{}
}
for j := range result.Vulnerabilities {
result.Vulnerabilities[j].Layer = ftypes.Layer{}
}
for j := range result.Misconfigurations {
result.Misconfigurations[j].Layer = ftypes.Layer{}
}
}
}

0 comments on commit 0205c55

Please sign in to comment.