diff --git a/internal/vulnerability/runner.go b/internal/vulnerability/runner.go index b7d37837ff..a86b30d15c 100644 --- a/internal/vulnerability/runner.go +++ b/internal/vulnerability/runner.go @@ -23,6 +23,7 @@ import ( "time" "github.com/aquasecurity/trivy/pkg/commands/artifact" + ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" "github.com/aquasecurity/trivy/pkg/flag" trivy_types "github.com/aquasecurity/trivy/pkg/types" "github.com/elastic/elastic-agent-libs/logp" @@ -50,7 +51,8 @@ func NewVulnerabilityRunner(log *logp.Logger) (VulnerabilityRunner, error) { Debug: true, }, PackageOptions: flag.PackageOptions{ - PkgTypes: []string{trivy_types.PkgTypeOS, trivy_types.PkgTypeLibrary}, + PkgTypes: []string{trivy_types.PkgTypeOS, trivy_types.PkgTypeLibrary}, + PkgRelationships: ftypes.Relationships, }, ScanOptions: flag.ScanOptions{ Scanners: []trivy_types.Scanner{trivy_types.VulnerabilityScanner}, diff --git a/internal/vulnerability/scanner.go b/internal/vulnerability/scanner.go index 57f42bcb66..f235450f0a 100644 --- a/internal/vulnerability/scanner.go +++ b/internal/vulnerability/scanner.go @@ -26,6 +26,7 @@ import ( "time" db_types "github.com/aquasecurity/trivy-db/pkg/types" + ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" "github.com/aquasecurity/trivy/pkg/flag" trivy_types "github.com/aquasecurity/trivy/pkg/types" "github.com/elastic/elastic-agent-libs/logp" @@ -118,7 +119,8 @@ func (f VulnerabilityScanner) scan(ctx context.Context, snap ec2.EBSSnapshot) { Debug: true, }, PackageOptions: flag.PackageOptions{ - PkgTypes: []string{trivy_types.PkgTypeOS, trivy_types.PkgTypeLibrary}, + PkgTypes: []string{trivy_types.PkgTypeOS, trivy_types.PkgTypeLibrary}, + PkgRelationships: ftypes.Relationships, }, ScanOptions: flag.ScanOptions{ Target: fmt.Sprint("ebs:", snap.SnapshotId),