Skip to content

Commit

Permalink
feat(rocky): support modular package
Browse files Browse the repository at this point in the history
  • Loading branch information
MaineK00n committed Jan 25, 2022
1 parent a31ddbe commit d8b47f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 0 additions & 8 deletions pkg/detector/ospkg/rocky/rocky.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,7 @@ func (s *Scanner) Detect(osVer string, pkgs []ftypes.Package) ([]types.DetectedV
log.Logger.Debugf("Rocky Linux: the number of packages: %d", len(pkgs))

var vulns []types.DetectedVulnerability
var skipPkgs []string
for _, pkg := range pkgs {
if pkg.Modularitylabel != "" {
skipPkgs = append(skipPkgs, pkg.Name)
continue
}
pkgName := addModularNamespace(pkg.Name, pkg.Modularitylabel)
advisories, err := s.vs.Get(osVer, pkgName)
if err != nil {
Expand All @@ -95,9 +90,6 @@ func (s *Scanner) Detect(osVer string, pkgs []ftypes.Package) ([]types.DetectedV
}
}
}
if len(skipPkgs) > 0 {
log.Logger.Infof("Skipped detection of these packages: %q because modular packages cannot be detected correctly due to a bug in Rocky Linux Errata. See also: https://forums.rockylinux.org/t/some-errata-missing-in-comparison-with-rhel-and-almalinux/3843", skipPkgs)
}

return vulns, nil
}
Expand Down
12 changes: 10 additions & 2 deletions pkg/detector/ospkg/rocky/rocky_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestScanner_Detect(t *testing.T) {
},
},
{
name: "skip modular package",
name: "modular package",
fixtures: []string{"testdata/fixtures/modular.yaml"},
args: args{
osVer: "8.5",
Expand All @@ -81,7 +81,15 @@ func TestScanner_Detect(t *testing.T) {
},
},
},
want: nil,
want: []types.DetectedVulnerability{
{
PkgName: "nginx",
VulnerabilityID: "CVE-2021-23017",
InstalledVersion: "1:1.16.1-2.module+el8.4.0+543+efbf198b.0",
FixedVersion: "1:1.16.1-2.module+el8.4.0+543+efbf198b.1",
Layer: ftypes.Layer{},
},
},
},
{
name: "Get returns an error",
Expand Down

0 comments on commit d8b47f4

Please sign in to comment.