mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-12 15:50:15 -08:00
Added support of list-all-packages (#574)
* Added support of list-all-packages * updated Readme * Added library packages and fixed import name * updated env var name * Sorting packages in scan
This commit is contained in:
@@ -182,6 +182,12 @@ var (
|
||||
EnvVars: []string{"TRIVY_IGNORE_POLICY"},
|
||||
}
|
||||
|
||||
listAllPackages = cli.BoolFlag{
|
||||
Name: "list-all-pkgs",
|
||||
Usage: "enabling the option will output all packages regardless of vulnerability",
|
||||
EnvVars: []string{"TRIVY_LIST_ALL_PKGS"},
|
||||
}
|
||||
|
||||
globalFlags = []cli.Flag{
|
||||
&quietFlag,
|
||||
&debugFlag,
|
||||
@@ -207,6 +213,7 @@ var (
|
||||
&timeoutFlag,
|
||||
&lightFlag,
|
||||
&ignorePolicy,
|
||||
&listAllPackages,
|
||||
}
|
||||
|
||||
// deprecated options
|
||||
@@ -360,6 +367,7 @@ func NewFilesystemCommand() *cli.Command {
|
||||
&timeoutFlag,
|
||||
&noProgressFlag,
|
||||
&ignorePolicy,
|
||||
&listAllPackages,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -389,6 +397,7 @@ func NewRepositoryCommand() *cli.Command {
|
||||
&timeoutFlag,
|
||||
&noProgressFlag,
|
||||
&ignorePolicy,
|
||||
&listAllPackages,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ func run(c config.Config, initializeScanner InitializeScanner) error {
|
||||
scanOptions := types.ScanOptions{
|
||||
VulnType: c.VulnType,
|
||||
ScanRemovedPackages: c.ScanRemovedPkgs, // this is valid only for image subcommand
|
||||
ListAllPackages: c.ListAllPkgs,
|
||||
}
|
||||
log.Logger.Debugf("Vulnerability type: %s", scanOptions.VulnType)
|
||||
|
||||
|
||||
@@ -9,11 +9,13 @@ import (
|
||||
|
||||
type ImageConfig struct {
|
||||
ScanRemovedPkgs bool
|
||||
ListAllPkgs bool
|
||||
}
|
||||
|
||||
func NewImageConfig(c *cli.Context) ImageConfig {
|
||||
return ImageConfig{
|
||||
ScanRemovedPkgs: c.Bool("removed-pkgs"),
|
||||
ListAllPkgs: c.Bool("list-all-pkgs"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user