mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-12 15:50:15 -08:00
fix(rootio): check full version to detect root.io packages [backport: release/v0.64] (#9120)
Co-authored-by: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8cf1bf9f6f
commit
53adfba3c2
1
.github/workflows/semantic-pr.yaml
vendored
1
.github/workflows/semantic-pr.yaml
vendored
@@ -67,6 +67,7 @@ jobs:
|
||||
distroless
|
||||
windows
|
||||
minimos
|
||||
rootio
|
||||
|
||||
# Languages
|
||||
ruby
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user