config

package
v0.0.0-...-c30fbfa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 9 Imported by: 11

Documentation

Index

Constants

View Source
const (
	AnalyzerList  = "ANALYZER_LIST"
	AnalyzerScope = "ANALYZER_SCOPE"
	OutputFormat  = "ANALYZER_OUTPUT_FORMAT"
)
View Source
const (
	ScannerDependencyTrackAPIKey                         = "SCANNER_DEPENDENCY_TRACK_API_KEY"
	ScannerDependencyTrackHost                           = "SCANNER_DEPENDENCY_TRACK_HOST"
	ScannerDependencyTrackProjectName                    = "SCANNER_DEPENDENCY_TRACK_PROJECT_NAME"
	ScannerDependencyTrackProjectVersion                 = "SCANNER_DEPENDENCY_TRACK_PROJECT_VERSION"
	ScannerDependencyTrackShouldDeleteProject            = "SCANNER_DEPENDENCY_TRACK_SHOULD_DELETE_PROJECT"
	ScannerDependencyTrackDisableTLS                     = "SCANNER_DEPENDENCY_TRACK_DISABLE_TLS"
	ScannerDependencyTrackInsecureSkipVerify             = "SCANNER_DEPENDENCY_TRACK_INSECURE_SKIP_VERIFY"
	ScannerDependencyTrackFetchVulnerabilitiesRetryCount = "SCANNER_DEPENDENCY_TRACK_FETCH_VULNERABILITIES_RETRY_COUNT"
	ScannerDependencyTrackFetchVulnerabilitiesRetrySleep = "SCANNER_DEPENDENCY_TRACK_FETCH_VULNERABILITIES_RETRY_SLEEP"
)
View Source
const (
	ScannerLocalGrypeScope      = "SCANNER_LOCAL_GRYPE_SCOPE"
	ScannerLocalGrypeDBRootDir  = "SCANNER_LOCAL_GRYPE_DB_ROOT_DIR"
	ScannerLocalGrypeListingURL = "SCANNER_LOCAL_GRYPE_LISTING_URL"
	ScannerLocalGrypeUpdateDB   = "SCANNER_LOCAL_GRYPE_UPDATE_DB"
)
View Source
const (
	ScannerRemoteGrypeServerAddress = "SCANNER_REMOTE_GRYPE_SERVER_ADDRESS"
	ScannerRemoteGrypeServerSchemes = "SCANNER_REMOTE_GRYPE_SERVER_SCHEMES"
	ScannerRemoteGrypeServerTimeout = "SCANNER_REMOTE_GRYPE_SERVER_TIMEOUT"
)
View Source
const (
	ResultServiceAddress  = "RESULT_SERVICE_ADDR"
	ImageIDToScan         = "IMAGE_ID_TO_SCAN"
	ImageHashToScan       = "IMAGE_HASH_TO_SCAN"
	ImageNameToScan       = "IMAGE_NAME_TO_SCAN"
	ScanUUID              = "SCAN_UUID"
	RegistrySkipVerifyTlS = "REGISTRY_SKIP_VERIFY_TLS" // nolint:gosec
	RegistryUseHTTP       = "REGISTRY_USE_HTTP"
	ImagePullSecretPath   = "IMAGE_PULL_SECRET_PATH" // nolint:gosec
)
View Source
const (
	AnalyzerTrivyTimeoutSeconds = "ANALYZER_TRIVY_TIMEOUT_SECONDS"
	AnalyzerTrivyCacheDir       = "ANALYZER_TRIVY_CACHE_DIRECTORY"
	AnalyzerTrivyTempDir        = "ANALYZER_TRIVY_TEMP_DIRECTORY"
)
View Source
const (
	ScannerTrivyTimeoutSeconds = "SCANNER_TRIVY_TIMEOUT_SECONDS"
	ScannerTrivyCacheDir       = "SCANNER_TRIVY_CACHE_DIRECTORY"
	ScannerTrivyTempDir        = "SCANNER_TRIVY_TEMP_DIRECTORY"
	ScannerTrivyServerAddress  = "SCANNER_TRIVY_SERVER_ADDRESS"
	ScannerTrivyServerToken    = "SCANNER_TRIVY_SERVER_TOKEN" // nolint:gosec
)
View Source
const AnalyzerTrivyTimeoutSecondsDefault = 300
View Source
const LocalImageScan = "LOCAL_IMAGE_SCAN"
View Source
const (
	ScannerGrypeMode = "SCANNER_GRYPE_MODE"
)
View Source
const ScannerTrivyTimeoutSecondsDefault = 300
View Source
const (
	ScannersList = "SCANNERS_LIST"
)

Variables

This section is empty.

Functions

func CreateRegistryOptions

func CreateRegistryOptions(registry *Registry) *image.RegistryOptions

Types

type Analyzer

type Analyzer struct {
	OutputFormat string              `yaml:"output_format" mapstructure:"output_format"`
	AnalyzerList []string            `yaml:"analyzer_list" mapstructure:"analyzer_list"`
	Scope        string              `yaml:"scope" mapstructure:"scope"`
	TrivyConfig  AnalyzerTrivyConfig `yaml:"trivy_config" mapstructure:"trivy_config"`
}

TODO: maybe we need to extend the unified config.

func LoadAnalyzerConfig

func LoadAnalyzerConfig() *Analyzer

type AnalyzerTrivyConfig

type AnalyzerTrivyConfig struct {
	Timeout  int    `yaml:"timeout" mapstructure:"timeout"`
	CacheDir string `yaml:"cache_dir" mapstructure:"cache_dir"`
	TempDir  string `yaml:"temp_dir" mapstructure:"temp_dir"`
}

func LoadAnalyzerTrivyConfig

func LoadAnalyzerTrivyConfig() AnalyzerTrivyConfig

type AnalyzerTrivyConfigEx

type AnalyzerTrivyConfigEx struct {
	Timeout  time.Duration
	CacheDir string
	TempDir  string
	Registry *Registry
}

func CreateAnalyzerTrivyConfigEx

func CreateAnalyzerTrivyConfigEx(analyzer *Analyzer, registry *Registry) AnalyzerTrivyConfigEx

type Auth

type Auth struct {
	Authority string `yaml:"authority" json:"authority" mapstructure:"authority"`
	Username  string `yaml:"-" json:"-" mapstructure:"username"`
	Password  string `yaml:"-" json:"-" mapstructure:"password"`
	Token     string `yaml:"-" json:"-" mapstructure:"token"`
}

type Config

type Config struct {
	Registry       *Registry `yaml:"registry" mapstructure:"registry"`
	Analyzer       *Analyzer `yaml:"analyzer" mapstructure:"analyzer"`
	Scanner        *Scanner  `yaml:"scanner" mapstructure:"scanner"`
	LocalImageScan bool      `yaml:"local_image_scan" mapstructure:"local_image_scan"`
}

func (Config) IsConfig

func (Config) IsConfig()

type DependencyTrackConfig

type DependencyTrackConfig struct {
	APIKey                         string        `json:"-"`
	Host                           string        `json:"host"`
	ProjectName                    string        `json:"project-name"`
	ProjectVersion                 string        `json:"project-version"`
	ShouldDeleteProject            bool          `json:"should-delete-project"`
	DisableTLS                     bool          `json:"disable-tls"`
	InsecureSkipVerify             bool          `json:"insecure-skip-verify"`
	FetchVulnerabilitiesRetryCount int           `json:"fetch-vulnerabilities-retry-count"`
	FetchVulnerabilitiesRetrySleep time.Duration `json:"fetch-vulnerabilities-retry-sleep"`
}

func ConvertToDependencyTrackConfig

func ConvertToDependencyTrackConfig(scanner *Scanner, logger *logrus.Entry) DependencyTrackConfig

func LoadDependencyTrackConfig

func LoadDependencyTrackConfig() DependencyTrackConfig

type GomodConfig

type GomodConfig struct{}

func ConvertToGomodConfig

func ConvertToGomodConfig(_ *Analyzer) GomodConfig

type GrypeConfig

type GrypeConfig struct {
	LocalGrypeConfig  `yaml:"local_grype_config" mapstructure:"local_grype_config"`
	RemoteGrypeConfig `yaml:"remote_grype_config" mapstructure:"remote_grype_config"`
	Mode              Mode `yaml:"mode" mapstructure:"mode"`
}

func LoadGrypeConfig

func LoadGrypeConfig() GrypeConfig

type LocalGrypeConfig

type LocalGrypeConfig struct {
	UpdateDB   bool         `yaml:"update_db" mapstructure:"update_db"`
	DBRootDir  string       `yaml:"db_root_dir" mapstructure:"db_root_dir"` // Location to write the vulnerability database cache.
	ListingURL string       `yaml:"listing_url" mapstructure:"listing_url"` // URL of the vulnerability database.
	Scope      source.Scope `yaml:"scope" mapstructure:"scope"`             // indicates "how" or from "which perspectives" the source object should be cataloged from.
}

type LocalGrypeConfigEx

type LocalGrypeConfigEx struct {
	LocalGrypeConfig
	RegistryOptions *image.RegistryOptions
}

func ConvertToLocalGrypeConfig

func ConvertToLocalGrypeConfig(scanner *Scanner, registry *Registry) LocalGrypeConfigEx

type Mode

type Mode string
const (
	ModeLocal  Mode = "LOCAL"
	ModeRemote Mode = "REMOTE"
)

type Registry

type Registry struct {
	SkipVerifyTLS bool   `yaml:"skip-verify-tls" json:"skip-verify-tls" mapstructure:"skip-verify-tls"`
	UseHTTP       bool   `yaml:"use-http" json:"use-http" mapstructure:"use-http"`
	Auths         []Auth `yaml:"auths" json:"auths" mapstructure:"auths"`
}

func LoadRuntimeScannerRegistryConfig

func LoadRuntimeScannerRegistryConfig(imageID string) *Registry

type RemoteGrypeConfig

type RemoteGrypeConfig struct {
	GrypeServerAddress string        `yaml:"grype_server_address" mapstructure:"grype_server_address"`
	GrypeServerSchemes []string      `yaml:"grype_server_schemes" mapstructure:"grype_server_schemes"`
	GrypeServerTimeout time.Duration `yaml:"grype_server_timeout" mapstructure:"grype_server_timeout"`
}

type Scanner

type Scanner struct {
	ScannersList          []string              `yaml:"scanners_list" mapstructure:"scanners_list"`
	GrypeConfig           GrypeConfig           `yaml:"grype_config" mapstructure:"grype_config"`
	DependencyTrackConfig DependencyTrackConfig `yaml:"dependency_track_config" mapstructure:"dependency_track_config"`
	TrivyConfig           ScannerTrivyConfig    `yaml:"trivy_config" mapstructure:"trivy_config"`
}

func LoadScannerConfig

func LoadScannerConfig() *Scanner

type ScannerTrivyConfig

type ScannerTrivyConfig struct {
	Timeout     int
	ServerAddr  string
	ServerToken string
	CacheDir    string
	TempDir     string
}

func LoadScannerTrivyConfig

func LoadScannerTrivyConfig() ScannerTrivyConfig

type ScannerTrivyConfigEx

type ScannerTrivyConfigEx struct {
	Timeout     time.Duration
	CacheDir    string
	TempDir     string
	ServerAddr  string
	ServerToken string
	Registry    *Registry
}

func CreateScannerTrivyConfigEx

func CreateScannerTrivyConfigEx(scanner *Scanner, registry *Registry) ScannerTrivyConfigEx

type SyftConfig

type SyftConfig struct {
	Scope           source.Scope
	RegistryOptions *image.RegistryOptions
}

TODO: maybe we need to extend syft confg.

func CreateSyftConfig

func CreateSyftConfig(analyzer *Analyzer, registry *Registry) SyftConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL