diff --git a/pkg/scanner/local/scan.go b/pkg/scanner/local/scan.go index e1e081383a9..1ce2204b7de 100644 --- a/pkg/scanner/local/scan.go +++ b/pkg/scanner/local/scan.go @@ -290,7 +290,7 @@ func (s Scanner) scanLangPkgs(apps []ftypes.Application) (types.Results, error) if err != nil { return nil, xerrors.Errorf("failed vulnerability detection of libraries: %w", err) } else if len(vulns) == 0 { - return nil, nil + continue } target := app.FilePath diff --git a/pkg/scanner/local/scan_test.go b/pkg/scanner/local/scan_test.go index 68173607aa1..3fb86eeee49 100644 --- a/pkg/scanner/local/scan_test.go +++ b/pkg/scanner/local/scan_test.go @@ -311,11 +311,24 @@ func TestScanner_Scan(t *testing.T) { OS: &ftypes.OS{}, Applications: []ftypes.Application{ { - Type: "bundler", + Type: ftypes.Bundler, FilePath: "/app/Gemfile.lock", Libraries: []ftypes.Package{ { - Name: "rails", + Name: "innocent", // no vulnerability + Version: "1.2.3", + Layer: ftypes.Layer{ + DiffID: "sha256:9922bc15eeefe1637b803ef2106f178152ce19a391f24aec838cbe2e48e73303", + }, + }, + }, + }, + { + Type: ftypes.Bundler, + FilePath: "/app/Gemfile.lock", + Libraries: []ftypes.Package{ + { + Name: "rails", // one vulnerability Version: "4.0.2", Layer: ftypes.Layer{ DiffID: "sha256:9922bc15eeefe1637b803ef2106f178152ce19a391f24aec838cbe2e48e73303",