mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 23:26:39 -08:00
refactor: move setting scanners when using compliance reports to flag parsing (#6619)
This commit is contained in:
@@ -533,25 +533,6 @@ func initScannerConfig(opts flag.Options, cacheClient cache.Cache) (ScannerConfi
|
||||
target = opts.Input
|
||||
}
|
||||
|
||||
if opts.Compliance.Spec.ID != "" {
|
||||
// set scanners types by spec
|
||||
scanners, err := opts.Compliance.Scanners()
|
||||
if err != nil {
|
||||
return ScannerConfig{}, types.ScanOptions{}, xerrors.Errorf("scanner error: %w", err)
|
||||
}
|
||||
|
||||
opts.Scanners = scanners
|
||||
opts.ImageConfigScanners = nil
|
||||
// TODO: define image-config-scanners in the spec
|
||||
if opts.Compliance.Spec.ID == "docker-cis" {
|
||||
opts.Scanners = types.Scanners{types.VulnerabilityScanner}
|
||||
opts.ImageConfigScanners = types.Scanners{
|
||||
types.MisconfigScanner,
|
||||
types.SecretScanner,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scanOptions := types.ScanOptions{
|
||||
VulnType: opts.VulnType,
|
||||
Scanners: opts.Scanners,
|
||||
|
||||
Reference in New Issue
Block a user