config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	Enabled  bool
	Port     int
	APIKey   string
	ReadOnly bool
}

APIConfig configures the HTTP API server

type AttestationConfig

type AttestationConfig struct {
	KeyBased struct {
		Key         string // Base64-encoded key content
		KeyPassword string
	}
	RekorURL     string
	FulcioURL    string
	UseKeyless   bool
	OIDCIssuer   string
	OIDCClientID string
}

AttestationConfig configures Sigstore attestation and signing

type Config

type Config struct {
	RegsyncPath   string
	Queue         QueueConfig
	Worker        WorkerConfig
	Scanner       ScannerConfig
	Attestation   AttestationConfig
	StateStore    StateStoreConfig
	API           APIConfig
	Observability ObservabilityConfig
}

Config represents the complete application configuration

func Load

func Load() (*Config, error)

Load loads configuration from environment variables and suppline.yml defaults

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration

type Defaults

type Defaults struct {
	Parallel              int           `yaml:"parallel"`
	RescanInterval        string        `yaml:"x-rescanInterval,omitempty"`
	WorkerPollInterval    string        `yaml:"x-worker-poll-interval,omitempty"`
	SCAIValidityExtension string        `yaml:"x-scaiValidityExtension,omitempty"`
	Policy                *PolicyConfig `yaml:"x-policy,omitempty"`
}

Defaults contains default configuration values

type ObservabilityConfig

type ObservabilityConfig struct {
	LogLevel        string
	MetricsPort     int
	HealthCheckPort int
}

ObservabilityConfig configures logging and metrics

type PolicyConfig

type PolicyConfig struct {
	Expression     string `yaml:"expression"`
	FailureMessage string `yaml:"failureMessage,omitempty"`
}

PolicyConfig represents a CEL-based security policy

type QueueConfig

type QueueConfig struct {
	BufferSize int
}

QueueConfig configures the in-memory task queue

type RegistryCredential

type RegistryCredential struct {
	Registry      string `yaml:"registry"`
	User          string `yaml:"user"`
	Pass          string `yaml:"pass"`
	RepoAuth      bool   `yaml:"repoAuth"`
	ReqPerSec     int    `yaml:"reqPerSec"`
	ReqConcurrent int    `yaml:"reqConcurrent"`
}

RegistryCredential contains authentication information for a registry

type RegsyncConfig

type RegsyncConfig struct {
	Version  int                  `yaml:"version"`
	Creds    []RegistryCredential `yaml:"creds"`
	Defaults Defaults             `yaml:"defaults"`
	Sync     []SyncEntry          `yaml:"sync"`
}

RegsyncConfig represents the complete regsync configuration

func ParseRegsync

func ParseRegsync(path string) (*RegsyncConfig, error)

ParseRegsync reads and parses a suppline.yml configuration file

func (*RegsyncConfig) GetCredentialForRegistry

func (c *RegsyncConfig) GetCredentialForRegistry(registry string) *RegistryCredential

GetCredentialForRegistry returns the credential for a specific registry

func (*RegsyncConfig) GetExpiringTolerations

func (c *RegsyncConfig) GetExpiringTolerations(within time.Duration) []types.CVEToleration

GetExpiringTolerations returns tolerations that will expire within the specified duration

func (*RegsyncConfig) GetPolicyForTarget

func (c *RegsyncConfig) GetPolicyForTarget(target string) *PolicyConfig

GetPolicyForTarget returns the policy configuration for a specific target repository Returns the sync entry's policy if specified, otherwise the default, otherwise nil Handles both type=repository (exact match) and type=image (strips tag for matching)

func (*RegsyncConfig) GetRescanInterval

func (c *RegsyncConfig) GetRescanInterval(target string) (time.Duration, error)

GetRescanInterval returns the rescan interval for a specific target repository Returns the sync entry's interval if specified, otherwise the default, otherwise 7d Handles both type=repository (exact match) and type=image (strips tag for matching)

func (*RegsyncConfig) GetSCAIValidityExtension

func (c *RegsyncConfig) GetSCAIValidityExtension(target string) (time.Duration, error)

GetSCAIValidityExtension returns the SCAI validity extension for a specific target repository This is the additional time beyond the next scheduled scan that the SCAI attestation remains valid Returns the sync entry's extension if specified, otherwise the default, otherwise 1d Handles both type=repository (exact match) and type=image (strips tag for matching)

func (*RegsyncConfig) GetTagsForRepository

func (c *RegsyncConfig) GetTagsForRepository(repo string) []string

GetTagsForRepository returns the tags that should be processed for a repository For type=repository entries, returns nil (meaning all tags should be listed) For type=image entries, returns the specific tag from the target

func (*RegsyncConfig) GetTargetRepositories

func (c *RegsyncConfig) GetTargetRepositories() []string

GetTargetRepositories returns all target repositories from sync entries For type=image entries, strips the tag to return just the repository name

func (*RegsyncConfig) GetTolerationsForTarget

func (c *RegsyncConfig) GetTolerationsForTarget(target string) []types.CVEToleration

GetTolerationsForTarget returns CVE tolerations for a specific target repository Handles both type=repository (exact match) and type=image (strips tag for matching)

func (*RegsyncConfig) GetWorkerPollInterval

func (c *RegsyncConfig) GetWorkerPollInterval() (time.Duration, error)

GetWorkerPollInterval returns the worker poll interval from defaults Returns the default if specified, otherwise 5 seconds

func (*RegsyncConfig) IsToleratedCVE

func (c *RegsyncConfig) IsToleratedCVE(target, cveID string) (bool, *types.CVEToleration)

IsToleratedCVE checks if a CVE is tolerated for a specific target repository Returns true if the CVE is tolerated and not expired

type ScannerConfig

type ScannerConfig struct {
	ServerAddr    string
	Token         string
	CustomHeaders map[string]string
	Timeout       time.Duration
	Insecure      bool
	RegsyncPath   string       // Path to suppline.yml for registry credentials
	Logger        *slog.Logger // Logger instance for structured logging
}

ScannerConfig configures the Trivy scanner connection

type StateStoreConfig

type StateStoreConfig struct {
	Type           string
	PostgresURL    string
	SQLitePath     string
	RescanInterval time.Duration
}

StateStoreConfig configures the state store

type SyncEntry

type SyncEntry struct {
	Source                string                `yaml:"source"`
	Target                string                `yaml:"target"`
	Type                  string                `yaml:"type"`
	Schedule              string                `yaml:"schedule,omitempty"`
	Platform              string                `yaml:"platform,omitempty"`
	Tags                  *TagFilter            `yaml:"tags,omitempty"`
	Tolerate              []types.CVEToleration `yaml:"x-tolerate,omitempty"` // Using canonical type
	RescanInterval        string                `yaml:"x-rescanInterval,omitempty"`
	SCAIValidityExtension string                `yaml:"x-scaiValidityExtension,omitempty"`
	Policy                *PolicyConfig         `yaml:"x-policy,omitempty"`
}

SyncEntry represents a single sync configuration

type TagFilter

type TagFilter struct {
	SemverRange []string `yaml:"semverRange,omitempty"`
	Deny        []string `yaml:"deny,omitempty"`
}

TagFilter defines tag filtering rules

type WorkerConfig

type WorkerConfig struct {
	PollInterval  time.Duration
	RetryAttempts int
	RetryBackoff  time.Duration
}

WorkerConfig configures the worker behavior

Jump to

Keyboard shortcuts

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