Skip to content

Commit

Permalink
fix: switch scanner to using new config methods
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Aug 29, 2024
1 parent b256cea commit 72de007
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion pkg/osvscanner/osvscanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,17 @@ func filterIgnoredPackages(r reporter.Reporter, packages []scannedPackage, confi
out := make([]scannedPackage, 0, len(packages))
for _, p := range packages {
configToUse := configManager.Get(r, p.Source.Path)
if ignore, ignoreLine := configToUse.ShouldIgnorePackageVersion(p.Name, p.Version, string(p.Ecosystem)); ignore {
if ignore, ignoreLine := configToUse.ShouldIgnorePackage(
models.PackageVulns{
Package: models.PackageInfo{
Name: p.Name,
Version: p.Version,
Ecosystem: string(p.Ecosystem),
Commit: p.Commit,
},
DepGroups: p.DepGroups,
},
); ignore {
pkgString := fmt.Sprintf("%s/%s/%s", p.Ecosystem, p.Name, p.Version)
r.Infof("Package %s has been filtered out because: %s\n", pkgString, ignoreLine.Reason)

Expand Down
2 changes: 1 addition & 1 deletion pkg/osvscanner/vulnerability_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func buildVulnerabilityResults(
}
if actions.ScanLicensesSummary || len(actions.ScanLicensesAllowlist) > 0 {
configToUse := configManager.Get(r, rawPkg.Source.Path)
if override, entry := configToUse.ShouldOverridePackageVersionLicense(pkg.Package.Name, pkg.Package.Version, pkg.Package.Ecosystem); override {
if override, entry := configToUse.ShouldOverridePackageLicense(pkg); override {
overrideLicenses := make([]models.License, len(entry.License.Override))
for j, license := range entry.License.Override {
overrideLicenses[j] = models.License(license)
Expand Down

0 comments on commit 72de007

Please sign in to comment.