Skip to content

Commit

Permalink
Add default cli values of --pkg-relationships
Browse files Browse the repository at this point in the history
Package relationship has been introduced on aquasecurity/trivy#7237 and using CLI there are default relationship values (all). Using the library directly there is no default value and having 0 relationships and retrieving 0 finginds. Therefore on this commit we added the default value with all relationships
  • Loading branch information
romulets committed Aug 9, 2024
1 parent d598cdd commit ad18518
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion internal/vulnerability/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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},
Expand Down
4 changes: 3 additions & 1 deletion internal/vulnerability/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit ad18518

Please sign in to comment.