diff --git a/.github/workflows/semantic-pr.yaml b/.github/workflows/semantic-pr.yaml index f798ecffe8b3..8c8ad5f84e53 100644 --- a/.github/workflows/semantic-pr.yaml +++ b/.github/workflows/semantic-pr.yaml @@ -67,6 +67,7 @@ jobs: distroless windows minimos + rootio # Languages ruby diff --git a/pkg/detector/ospkg/rootio/provider.go b/pkg/detector/ospkg/rootio/provider.go index 3c85bb5fa082..cda02142aca2 100644 --- a/pkg/detector/ospkg/rootio/provider.go +++ b/pkg/detector/ospkg/rootio/provider.go @@ -5,6 +5,7 @@ import ( "github.com/aquasecurity/trivy/pkg/detector/ospkg/driver" ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" + "github.com/aquasecurity/trivy/pkg/scan/utils" ) var ( @@ -37,7 +38,7 @@ func isRootIOEnvironment(osFamily ftypes.OSType, pkgs []ftypes.Package) bool { // hasPackageWithPattern checks if any package version matches the specified pattern func hasPackageWithPattern(pkgs []ftypes.Package, pattern *regexp.Regexp) bool { for _, pkg := range pkgs { - if pattern.MatchString(pkg.Version) { + if pattern.MatchString(utils.FormatVersion(pkg)) { return true } } diff --git a/pkg/detector/ospkg/rootio/provider_test.go b/pkg/detector/ospkg/rootio/provider_test.go index 6ba4b9515a59..7aa47b32cbbb 100644 --- a/pkg/detector/ospkg/rootio/provider_test.go +++ b/pkg/detector/ospkg/rootio/provider_test.go @@ -21,7 +21,7 @@ func TestProvider(t *testing.T) { name: "Debian with .root.io package", osFamily: ftypes.Debian, pkgs: []ftypes.Package{ - {Name: "libc6", Version: "2.31-13+deb11u4.root.io"}, + {Name: "libc6", Version: "2.31", Release: "13+deb11u4.root.io"}, {Name: "bash", Version: "5.1-2+deb11u1"}, }, want: true,