|
6 | 6 | "fmt"
|
7 | 7 | "os"
|
8 | 8 | "slices"
|
| 9 | + "strings" |
9 | 10 |
|
10 | 11 | "github.com/hashicorp/go-multierror"
|
11 | 12 | "github.com/samber/lo"
|
@@ -35,6 +36,7 @@ import (
|
35 | 36 | "github.com/aquasecurity/trivy/pkg/types"
|
36 | 37 | "github.com/aquasecurity/trivy/pkg/version/doc"
|
37 | 38 | xhttp "github.com/aquasecurity/trivy/pkg/x/http"
|
| 39 | + xstrings "github.com/aquasecurity/trivy/pkg/x/strings" |
38 | 40 | )
|
39 | 41 |
|
40 | 42 | // TargetKind represents what kind of artifact Trivy scans
|
@@ -578,9 +580,13 @@ func (r *runner) initScannerConfig(ctx context.Context, opts flag.Options) (Scan
|
578 | 580 | if opts.Scanners.Enabled(types.SecretScanner) {
|
579 | 581 | logger := log.WithPrefix(log.PrefixSecret)
|
580 | 582 | logger.Info("Secret scanning is enabled")
|
581 |
| - logger.Info("If your scanning is slow, please try '--scanners vuln' to disable secret scanning") |
| 583 | + if nonSecrets := lo.Without(opts.Scanners, types.SecretScanner, types.SBOMScanner); len(nonSecrets) > 0 { |
| 584 | + logger.Info(fmt.Sprintf( |
| 585 | + "If your scanning is slow, please try '--scanners %s' to disable secret scanning", |
| 586 | + strings.Join(xstrings.ToStringSlice(nonSecrets), ","))) |
| 587 | + } |
582 | 588 | // e.g. https://trivy.dev/latest/docs/scanner/secret/#recommendation
|
583 |
| - logger.Info(fmt.Sprintf("Please see also %s for faster secret detection", doc.URL("/docs/scanner/secret/", "recommendation"))) |
| 589 | + logger.Info(fmt.Sprintf("Please see %s for faster secret detection", doc.URL("/docs/scanner/secret/", "recommendation"))) |
584 | 590 | } else {
|
585 | 591 | opts.SecretConfigPath = ""
|
586 | 592 | }
|
|
0 commit comments