Skip to content

Commit

Permalink
fix(vuln): continue scanning when no vuln found in the first applicat…
Browse files Browse the repository at this point in the history
…ion (#2712)
  • Loading branch information
knqyf263 authored Aug 16, 2022
1 parent ed1fa89 commit aef02aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/scanner/local/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions pkg/scanner/local/scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit aef02aa

Please sign in to comment.