mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-23 15:37:50 -08:00
feat(image): custom docker host option (#3599)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/aquasecurity/trivy/pkg/fanal/analyzer/config"
|
||||
"github.com/aquasecurity/trivy/pkg/fanal/artifact"
|
||||
"github.com/aquasecurity/trivy/pkg/fanal/cache"
|
||||
ftypes "github.com/aquasecurity/trivy/pkg/fanal/types"
|
||||
"github.com/aquasecurity/trivy/pkg/flag"
|
||||
"github.com/aquasecurity/trivy/pkg/javadb"
|
||||
"github.com/aquasecurity/trivy/pkg/log"
|
||||
@@ -314,7 +315,7 @@ func (r *runner) initDB(ctx context.Context, opts flag.Options) error {
|
||||
|
||||
// download the database file
|
||||
noProgress := opts.Quiet || opts.NoProgress
|
||||
if err := operation.DownloadDB(ctx, opts.AppVersion, opts.CacheDir, opts.DBRepository, noProgress, opts.SkipDBUpdate, opts.Remote()); err != nil {
|
||||
if err := operation.DownloadDB(ctx, opts.AppVersion, opts.CacheDir, opts.DBRepository, noProgress, opts.SkipDBUpdate, opts.Registry()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -615,8 +616,6 @@ func initScannerConfig(opts flag.Options, cacheClient cache.Cache) (ScannerConfi
|
||||
fileChecksum = true
|
||||
}
|
||||
|
||||
remoteOpts := opts.Remote()
|
||||
|
||||
return ScannerConfig{
|
||||
Target: target,
|
||||
ArtifactCache: cacheClient,
|
||||
@@ -633,18 +632,25 @@ func initScannerConfig(opts flag.Options, cacheClient cache.Cache) (ScannerConfi
|
||||
FilePatterns: opts.FilePatterns,
|
||||
Offline: opts.OfflineScan,
|
||||
NoProgress: opts.NoProgress || opts.Quiet,
|
||||
Insecure: opts.Insecure,
|
||||
RepoBranch: opts.RepoBranch,
|
||||
RepoCommit: opts.RepoCommit,
|
||||
RepoTag: opts.RepoTag,
|
||||
SBOMSources: opts.SBOMSources,
|
||||
RekorURL: opts.RekorURL,
|
||||
Platform: opts.Platform,
|
||||
DockerHost: opts.DockerHost,
|
||||
Slow: opts.Slow,
|
||||
AWSRegion: opts.Region,
|
||||
FileChecksum: fileChecksum,
|
||||
|
||||
// For OCI registries
|
||||
RemoteOptions: remoteOpts,
|
||||
// For image scanning
|
||||
ImageOption: ftypes.ImageOptions{
|
||||
RegistryOptions: opts.Registry(),
|
||||
DockerOptions: ftypes.DockerOptions{
|
||||
Host: opts.DockerHost,
|
||||
},
|
||||
},
|
||||
|
||||
// For misconfiguration scanning
|
||||
MisconfScannerOption: configScannerOptions,
|
||||
|
||||
Reference in New Issue
Block a user