Documentation
¶
Overview ¶
Package config provides configuration management for Typosentinel This package implements structured configuration with validation and environment support
Index ¶
- func GetPresetDescription(preset SecurityPreset) string
- func GetProjectTypeDescription(projectType ProjectType) string
- type APIAuthentication
- type APIConfig
- type APIDocumentation
- type APIKeysConfig
- type APIRateLimiting
- type APIVersioning
- type AWSSecretsConfig
- type AlertChannel
- type AlertingConfig
- type AppConfig
- type ApplicationConfig
- type AuditConfig
- type AuthConfig
- type AuthenticationConfig
- type AuthzConfig
- type AutoScalerConfig
- type AzureSecretsConfig
- type BasicAuthConfig
- type BatchProcessorConfig
- type BuildIntegrityConfig
- type CICDConfig
- type CICDProvider
- type CORSConfig
- type CSRFConfig
- type CacheConfig
- type ConcurrencyConfig
- type Config
- type ConfigChangeEvent
- type ConfigEntry
- type ConfigManager
- func (cm *ConfigManager) AddValidator(validator ConfigValidator)
- func (cm *ConfigManager) AddWatcher(watcher ConfigWatcher)
- func (cm *ConfigManager) Delete(key string) error
- func (cm *ConfigManager) Get(key string) (interface{}, bool)
- func (cm *ConfigManager) GetAllConfig() map[string]*ConfigEntry
- func (cm *ConfigManager) GetBool(key string) bool
- func (cm *ConfigManager) GetChangeHistory(limit int) []ConfigChangeEvent
- func (cm *ConfigManager) GetDuration(key string) time.Duration
- func (cm *ConfigManager) GetInt(key string) int
- func (cm *ConfigManager) GetString(key string) string
- func (cm *ConfigManager) LoadConfig() error
- func (cm *ConfigManager) Set(key string, value interface{}, source ConfigSource) error
- func (cm *ConfigManager) Shutdown() error
- type ConfigManagerOptions
- type ConfigSource
- type ConfigValidator
- type ConfigWatcher
- type ConnectorConfig
- type CustomRiskRule
- type DBAuditConfig
- type DatabaseConfig
- type DependencyGraphConfig
- type DiscoveryCacheConfig
- type DiscoveryConfig
- type DocumentationConfig
- type EmailDelivery
- type EncryptionConfig
- type EndpointRateLimit
- type EnterpriseConfig
- type EnterpriseEncryptionConfig
- type EnterpriseJWTConfig
- type EnterpriseRateLimitConfig
- type EnterpriseSecurityConfig
- type EnterpriseTLSConfig
- type Environment
- type EnvironmentDetector
- type EnvironmentInfo
- type FeatureConfig
- type FeatureStoreConfig
- type FileAuditConfig
- type FilterConfig
- type GCPSecretsConfig
- type GlobalRateLimit
- type GlobalRateLimitConfig
- type GlobalRepositoryFilters
- type GraphDatabaseConfig
- type HoneypotDetectionConfig
- type IntegrationsConfig
- type JWTConfig
- type L1CacheConfig
- type L2CacheConfig
- type L3CacheConfig
- type LDAPConfig
- type LicenseConfig
- type LoadBalancerConfig
- type LoggingConfig
- type MFAConfig
- type MLAnalysisConfig
- type MLConfig
- type MLModelConfig
- type MLServiceConfig
- type Manager
- type MetricsConfig
- type ModelUpdatesConfig
- type MonitoringConfig
- type OAuth2Config
- type OutputConfig
- type PasswordPolicyConfig
- type PerIPRateLimit
- type PerUserRateLimit
- type PlatformConfig
- type PlatformDiscoveryConfig
- type PluginConfig
- type PluginEntry
- type PluginsConfig
- type PoliciesConfig
- type PolicyAction
- type PolicyCondition
- type PolicyConfig
- type PostprocessingConfig
- type PreprocessingConfig
- type PrivateConfig
- type ProcessingStep
- type ProjectDetector
- type ProjectInfo
- type ProjectSize
- type ProjectType
- type QueueConfig
- type RESTAPIConfig
- type RateLimitConfig
- type RedisConfig
- type RegistriesConfig
- type RegistryConfig
- type ReportDelivery
- type ReportTemplate
- type ReportingConfig
- type RepositoryConfig
- type RepositoryFilter
- type RepositoryRateLimitConfig
- type RepositoryWebhookConfig
- type RetentionPolicyConfig
- type RetryConfig
- type RiskCalculationConfig
- type RiskThresholds
- type RiskWeights
- type RoleConfig
- type S3Delivery
- type SAMLConfig
- type SMTPConfig
- type SSOConfig
- type SSOProvider
- type ScanCacheConfig
- type ScanFilterConfig
- type ScanPolicyConfig
- type ScanTarget
- type ScannerConfig
- type ScanningConfig
- type ScheduledReport
- type ScheduledRepositoryScan
- type SecretsConfig
- type SecurityConfig
- type SecurityPreset
- type ServerConfig
- type SmartDefaultsEngine
- type SupplyChainConfig
- type SupplyChainStorageConfig
- type SyslogAuditConfig
- type TLSConfig
- type ThreatFeedConfig
- type ThreatIntelConfig
- type ThreatIntelSource
- type ThreatIntelligenceConfig
- type ThrottlingConfig
- type TimeSeriesDBConfig
- type TimeoutConfig
- type TypoDetectionConfig
- type UserMapping
- type VaultConfig
- type WebhookAuditConfig
- type WebhookConfig
- type WebhookDelivery
- type WebhookEndpoint
- type WebhookPlatformConfig
- type WebhookSecurityConfig
- type WorkerPoolConfig
- type ZeroDayDetectionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPresetDescription ¶
func GetPresetDescription(preset SecurityPreset) string
GetPresetDescription returns a human-readable description of the preset
func GetProjectTypeDescription ¶
func GetProjectTypeDescription(projectType ProjectType) string
GetProjectTypeDescription returns a description of the detected project type
Types ¶
type APIAuthentication ¶
type APIAuthentication struct {
Enabled bool `mapstructure:"enabled"`
Method string `mapstructure:"method"`
Methods []string `mapstructure:"methods"`
JWT JWTConfig `mapstructure:"jwt"`
JWTSecret string `mapstructure:"jwt_secret"`
APIKeys []string `mapstructure:"api_keys"`
BasicAuth BasicAuthConfig `mapstructure:"basic_auth"`
}
APIAuthentication contains API authentication configuration
type APIConfig ¶
type APIConfig struct {
Prefix string `mapstructure:"prefix" validate:"required,min=1"`
Version string `mapstructure:"version" validate:"required,min=1"`
Documentation DocumentationConfig `mapstructure:"documentation"`
REST RESTAPIConfig `mapstructure:"rest"`
RateLimit APIRateLimiting `mapstructure:"rate_limit"`
Auth APIAuthentication `mapstructure:"auth"`
}
APIConfig contains API configuration
type APIDocumentation ¶
type APIDocumentation struct {
Enabled bool `mapstructure:"enabled"`
Path string `mapstructure:"path" validate:"required_if=Enabled true"`
Title string `mapstructure:"title"`
Version string `mapstructure:"version"`
}
APIDocumentation contains API documentation configuration
type APIKeysConfig ¶
type APIKeysConfig struct {
Enabled bool `mapstructure:"enabled"`
Keys []string `mapstructure:"keys" validate:"required_if=Enabled true,omitempty,dive,min=32"`
}
APIKeysConfig contains API keys configuration
type APIRateLimiting ¶
type APIRateLimiting struct {
Enabled bool `mapstructure:"enabled"`
RPS int `mapstructure:"rps"`
Burst int `mapstructure:"burst"`
Window time.Duration `mapstructure:"window"`
Global GlobalRateLimitConfig `mapstructure:"global"`
}
APIRateLimiting contains API rate limiting configuration
type APIVersioning ¶
type APIVersioning struct {
Enabled bool `mapstructure:"enabled"`
Strategy string `mapstructure:"strategy" validate:"oneof=path header query"`
DefaultVersion string `mapstructure:"default_version" validate:"required"`
SupportedVersions []string `mapstructure:"supported_versions" validate:"required,dive,required"`
}
APIVersioning contains API versioning configuration
type AWSSecretsConfig ¶
type AWSSecretsConfig struct {
Region string `yaml:"region" json:"region"`
AccessKey string `yaml:"access_key" json:"access_key"`
SecretKey string `yaml:"secret_key" json:"-"`
Profile string `yaml:"profile" json:"profile"`
}
AWSSecretsConfig holds AWS Secrets Manager configuration
type AlertChannel ¶
type AlertChannel struct {
Type string `mapstructure:"type" validate:"required,oneof=email slack webhook"`
Config map[string]string `mapstructure:"config"`
}
AlertChannel contains alert channel configuration
type AlertingConfig ¶
type AlertingConfig struct {
Enabled bool `mapstructure:"enabled"`
Channels []AlertChannel `mapstructure:"channels"`
Throttling ThrottlingConfig `mapstructure:"throttling"`
}
AlertingConfig contains alerting configuration
type AppConfig ¶
type AppConfig struct {
Name string `mapstructure:"name" validate:"required,min=1"`
Version string `mapstructure:"version" validate:"required,semver"`
Environment Environment `mapstructure:"environment" validate:"required,oneof=development testing staging production"`
Debug bool `mapstructure:"debug"`
Verbose bool `mapstructure:"verbose"`
LogLevel string `mapstructure:"log_level" validate:"required,oneof=debug info warn error"`
DataDir string `mapstructure:"data_dir" validate:"required,dir"`
TempDir string `mapstructure:"temp_dir" validate:"required"`
MaxWorkers int `mapstructure:"max_workers" validate:"required,min=1,max=100"`
}
AppConfig contains application-level configuration
type ApplicationConfig ¶
type ApplicationConfig struct {
// Server configuration
Server ServerConfig `yaml:"server" json:"server"`
// Database configuration
Database DatabaseConfig `yaml:"database" json:"database"`
// Redis configuration
Redis RedisConfig `yaml:"redis" json:"redis"`
// Scanner configuration
Scanner ScannerConfig `yaml:"scanner" json:"scanner"`
// Queue configuration
Queue QueueConfig `yaml:"queue" json:"queue"`
// Worker pool configuration
WorkerPool WorkerPoolConfig `yaml:"worker_pool" json:"worker_pool"`
// Cache configuration
Cache CacheConfig `yaml:"cache" json:"cache"`
// Monitoring configuration
Monitoring MonitoringConfig `yaml:"monitoring" json:"monitoring"`
// Load balancer configuration
LoadBalancer LoadBalancerConfig `yaml:"load_balancer" json:"load_balancer"`
// Auto scaler configuration
AutoScaler AutoScalerConfig `yaml:"auto_scaler" json:"auto_scaler"`
// Batch processor configuration
BatchProcessor BatchProcessorConfig `yaml:"batch_processor" json:"batch_processor"`
// Security configuration
Security SecurityConfig `yaml:"security" json:"security"`
// Logging configuration
Logging LoggingConfig `yaml:"logging" json:"logging"`
}
ApplicationConfig represents the main application configuration
type AuditConfig ¶
type AuditConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Level string `yaml:"level" json:"level"` // "basic", "detailed", "full"
Destination string `yaml:"destination" json:"destination"` // "file", "database", "syslog", "webhook"
File FileAuditConfig `yaml:"file" json:"file"`
Database DBAuditConfig `yaml:"database" json:"database"`
Syslog SyslogAuditConfig `yaml:"syslog" json:"syslog"`
Webhook WebhookAuditConfig `yaml:"webhook" json:"webhook"`
Retention time.Duration `yaml:"retention" json:"retention"`
Compression bool `yaml:"compression" json:"compression"`
}
AuditConfig holds audit logging configuration
type AuthConfig ¶
type AuthConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Method string `yaml:"method" json:"method"` // "jwt", "oauth2", "ldap", "saml"
JWT EnterpriseJWTConfig `yaml:"jwt" json:"jwt"`
OAuth2 OAuth2Config `yaml:"oauth2" json:"oauth2"`
LDAP LDAPConfig `yaml:"ldap" json:"ldap"`
SAML SAMLConfig `yaml:"saml" json:"saml"`
SessionTimeout time.Duration `yaml:"session_timeout" json:"session_timeout"`
MFA MFAConfig `yaml:"mfa" json:"mfa"`
}
AuthConfig holds authentication configuration
type AuthenticationConfig ¶
type AuthenticationConfig struct {
Type string `yaml:"type" json:"type"` // token, oauth, app, ssh
Token string `yaml:"token" json:"-"`
ClientID string `yaml:"client_id" json:"client_id"`
ClientSecret string `yaml:"client_secret" json:"-"`
AppID string `yaml:"app_id" json:"app_id"`
PrivateKey string `yaml:"private_key" json:"-"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"-"`
SSHKey string `yaml:"ssh_key" json:"-"`
}
AuthenticationConfig holds authentication settings
type AuthzConfig ¶
type AuthzConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Model string `yaml:"model" json:"model"` // "rbac", "abac", "acl"
Roles []RoleConfig `yaml:"roles" json:"roles"`
Policies []PolicyConfig `yaml:"policies" json:"policies"`
}
AuthzConfig holds authorization configuration
type AutoScalerConfig ¶
type AutoScalerConfig struct {
EvaluationInterval time.Duration `yaml:"evaluation_interval" json:"evaluation_interval"`
MaxHistorySize int `yaml:"max_history_size" json:"max_history_size"`
}
AutoScalerConfig holds auto scaler configuration
type AzureSecretsConfig ¶
type AzureSecretsConfig struct {
VaultURL string `yaml:"vault_url" json:"vault_url"`
ClientID string `yaml:"client_id" json:"client_id"`
ClientSecret string `yaml:"client_secret" json:"-"`
TenantID string `yaml:"tenant_id" json:"tenant_id"`
}
AzureSecretsConfig holds Azure Key Vault configuration
type BasicAuthConfig ¶
BasicAuthConfig contains basic auth configuration
type BatchProcessorConfig ¶
type BatchProcessorConfig struct {
MaxConcurrency int `yaml:"max_concurrency" json:"max_concurrency"`
BatchSize int `yaml:"batch_size" json:"batch_size"`
Timeout time.Duration `yaml:"timeout" json:"timeout"`
}
BatchProcessorConfig holds batch processor configuration
type BuildIntegrityConfig ¶
type BuildIntegrityConfig struct {
Enabled bool `mapstructure:"enabled"`
SignatureCheck bool `mapstructure:"signature_check"`
TamperingDetection bool `mapstructure:"tampering_detection"`
BuildAnalysis bool `mapstructure:"build_analysis"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
}
BuildIntegrityConfig contains build integrity detection configuration
type CICDConfig ¶
type CICDConfig []CICDProvider
CICDConfig contains CI/CD integration configuration
type CICDProvider ¶
type CICDProvider struct {
Name string `mapstructure:"name" validate:"required"`
Enabled bool `mapstructure:"enabled"`
Config map[string]string `mapstructure:"config"`
Settings map[string]interface{} `mapstructure:"settings"`
}
CICDProvider contains CI/CD provider configuration
type CORSConfig ¶
type CORSConfig struct {
Enabled bool `mapstructure:"enabled"`
AllowedOrigins []string `mapstructure:"allowed_origins"`
AllowedMethods []string `mapstructure:"allowed_methods"`
AllowedHeaders []string `mapstructure:"allowed_headers"`
ExposedHeaders []string `mapstructure:"exposed_headers"`
AllowCredentials bool `mapstructure:"allow_credentials"`
MaxAge int `mapstructure:"max_age" validate:"min=0"`
}
CORSConfig contains CORS configuration
type CSRFConfig ¶
type CSRFConfig struct {
Enabled bool `mapstructure:"enabled"`
Secret string `mapstructure:"secret" validate:"required_if=Enabled true,omitempty,min=32"`
CookieName string `mapstructure:"cookie_name" validate:"required_if=Enabled true,omitempty,min=1"`
HeaderName string `mapstructure:"header_name" validate:"required_if=Enabled true,omitempty,min=1"`
}
CSRFConfig contains CSRF protection configuration
type CacheConfig ¶
type CacheConfig struct {
Enabled bool `mapstructure:"enabled"`
Provider string `mapstructure:"provider" validate:"required_if=Enabled true,omitempty,oneof=memory redis"`
CacheDir string `mapstructure:"cache_dir" validate:"required_if=Enabled true"`
TTL time.Duration `mapstructure:"ttl" validate:"min=1m"`
MaxSize int `mapstructure:"max_size" validate:"min=100"`
CleanupInterval time.Duration `mapstructure:"cleanup_interval" validate:"min=1m"`
}
CacheConfig contains cache configuration
type ConcurrencyConfig ¶
type ConcurrencyConfig struct {
MaxConcurrentRepos int `yaml:"max_concurrent_repos" json:"max_concurrent_repos"`
MaxConcurrentFiles int `yaml:"max_concurrent_files" json:"max_concurrent_files"`
WorkerPoolSize int `yaml:"worker_pool_size" json:"worker_pool_size"`
}
ConcurrencyConfig holds concurrency settings
type Config ¶
type Config struct {
// Application settings
App AppConfig `mapstructure:"app" validate:"required"`
// Server settings
Server ServerConfig `mapstructure:"server" validate:"required"`
// Database settings
Database DatabaseConfig `mapstructure:"database" validate:"required"`
// Redis settings
Redis RedisConfig `mapstructure:"redis" validate:"required"`
// Logging settings
Logging LoggingConfig `mapstructure:"logging" validate:"required"`
// Metrics settings
Metrics MetricsConfig `mapstructure:"metrics" validate:"required"`
// Security settings
Security SecurityConfig `mapstructure:"security" validate:"required"`
// ML settings
ML MLConfig `mapstructure:"ml" validate:"required"`
// ML Service settings
MLService *MLServiceConfig `mapstructure:"ml_service"`
// Scanner settings
Scanner *ScannerConfig `mapstructure:"scanner"`
// API settings
API APIConfig `mapstructure:"api" validate:"required"`
// Rate limiting settings
RateLimit RateLimitConfig `mapstructure:"rate_limit" validate:"required"`
// Threat Intelligence settings
ThreatIntelligence *ThreatIntelligenceConfig `mapstructure:"threat_intelligence"`
// Plugins settings
Plugins *PluginsConfig `mapstructure:"plugins"`
// Cache settings
Cache *CacheConfig `mapstructure:"cache"`
// Typo Detection settings
TypoDetection *TypoDetectionConfig `mapstructure:"typo_detection"`
// Registries settings
Registries RegistriesConfig `mapstructure:"registries"`
// ML Analysis settings
MLAnalysis *MLAnalysisConfig `mapstructure:"ml_analysis"`
// Features settings
Features FeatureConfig `mapstructure:"features" validate:"required"`
// Policies settings
Policies PoliciesConfig `mapstructure:"policies" validate:"required"`
// Integrations settings
Integrations *IntegrationsConfig `mapstructure:"integrations"`
// Supply Chain Security settings
SupplyChain *SupplyChainConfig `mapstructure:"supply_chain"`
}
Config represents the application configuration
func LoadConfig ¶
LoadConfig loads configuration from a file
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig creates a new configuration with default values
func (*Config) GetDatabaseDSN ¶
GetDatabaseDSN returns the database connection string
func (*Config) GetRedisAddr ¶
GetRedisAddr returns the Redis address
func (*Config) GetServerAddr ¶
GetServerAddr returns the server address
func (*Config) IsFeatureEnabled ¶
IsFeatureEnabled checks if a feature is enabled
type ConfigChangeEvent ¶
type ConfigChangeEvent struct {
Key string `json:"key"`
OldValue interface{} `json:"old_value"`
NewValue interface{} `json:"new_value"`
Source ConfigSource `json:"source"`
Timestamp time.Time `json:"timestamp"`
Version int64 `json:"version"`
}
ConfigChangeEvent represents a configuration change
type ConfigEntry ¶
type ConfigEntry struct {
Key string `json:"key"`
Value interface{} `json:"value"`
Source ConfigSource `json:"source"`
LastUpdated time.Time `json:"last_updated"`
Version int64 `json:"version"`
Metadata map[string]interface{} `json:"metadata"`
}
ConfigEntry represents a configuration entry
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager manages application configuration
func NewConfigManager ¶
func NewConfigManager(options ConfigManagerOptions, redis *redis.Client) *ConfigManager
NewConfigManager creates a new configuration manager
func (*ConfigManager) AddValidator ¶
func (cm *ConfigManager) AddValidator(validator ConfigValidator)
AddValidator adds a configuration validator
func (*ConfigManager) AddWatcher ¶
func (cm *ConfigManager) AddWatcher(watcher ConfigWatcher)
AddWatcher adds a configuration watcher
func (*ConfigManager) Delete ¶
func (cm *ConfigManager) Delete(key string) error
Delete removes a configuration entry
func (*ConfigManager) Get ¶
func (cm *ConfigManager) Get(key string) (interface{}, bool)
Get retrieves a configuration value
func (*ConfigManager) GetAllConfig ¶
func (cm *ConfigManager) GetAllConfig() map[string]*ConfigEntry
GetAllConfig returns all configuration entries
func (*ConfigManager) GetBool ¶
func (cm *ConfigManager) GetBool(key string) bool
GetBool retrieves a boolean configuration value
func (*ConfigManager) GetChangeHistory ¶
func (cm *ConfigManager) GetChangeHistory(limit int) []ConfigChangeEvent
GetChangeHistory returns the configuration change history
func (*ConfigManager) GetDuration ¶
func (cm *ConfigManager) GetDuration(key string) time.Duration
GetDuration retrieves a duration configuration value
func (*ConfigManager) GetInt ¶
func (cm *ConfigManager) GetInt(key string) int
GetInt retrieves an integer configuration value
func (*ConfigManager) GetString ¶
func (cm *ConfigManager) GetString(key string) string
GetString retrieves a string configuration value
func (*ConfigManager) LoadConfig ¶
func (cm *ConfigManager) LoadConfig() error
LoadConfig loads configuration from various sources
func (*ConfigManager) Set ¶
func (cm *ConfigManager) Set(key string, value interface{}, source ConfigSource) error
Set updates a configuration value
func (*ConfigManager) Shutdown ¶
func (cm *ConfigManager) Shutdown() error
Shutdown gracefully shuts down the configuration manager
type ConfigManagerOptions ¶
type ConfigManagerOptions struct {
ConfigFile string `json:"config_file"`
RedisKeyPrefix string `json:"redis_key_prefix"`
WatchInterval time.Duration `json:"watch_interval"`
MaxHistorySize int `json:"max_history_size"`
EnableRedisSync bool `json:"enable_redis_sync"`
EnableFileWatch bool `json:"enable_file_watch"`
}
ConfigManagerOptions holds options for creating a config manager
type ConfigSource ¶
type ConfigSource int
ConfigSource defines where configuration comes from
const ( ConfigSourceFile ConfigSource = iota ConfigSourceRedis ConfigSourceEnvironment ConfigSourceDefault )
func (ConfigSource) String ¶
func (cs ConfigSource) String() string
type ConfigValidator ¶
type ConfigValidator interface {
Validate(key string, value interface{}) error
GetValidatedKeys() []string
}
ConfigValidator interface for validating configuration values
type ConfigWatcher ¶
type ConfigWatcher interface {
OnConfigChange(event ConfigChangeEvent) error
GetWatchedKeys() []string
}
ConfigWatcher interface for watching configuration changes
type ConnectorConfig ¶
type ConnectorConfig struct {
Type string `mapstructure:"type" validate:"required,oneof=splunk slack webhook email"`
Enabled bool `mapstructure:"enabled"`
Settings map[string]interface{} `mapstructure:"settings" validate:"required"`
Retry RetryConfig `mapstructure:"retry"`
Filters []string `mapstructure:"filters"`
}
ConnectorConfig contains connector configuration
type CustomRiskRule ¶
type CustomRiskRule struct {
Name string `mapstructure:"name" validate:"required"`
Condition string `mapstructure:"condition" validate:"required"`
RiskScore float64 `mapstructure:"risk_score" validate:"min=0,max=1"`
Description string `mapstructure:"description"`
Metadata map[string]interface{} `mapstructure:"metadata"`
}
CustomRiskRule contains custom risk calculation rules
type DBAuditConfig ¶
type DBAuditConfig struct {
Driver string `yaml:"driver" json:"driver"`
DSN string `yaml:"dsn" json:"-"`
Table string `yaml:"table" json:"table"`
BatchSize int `yaml:"batch_size" json:"batch_size"`
}
DBAuditConfig holds database audit configuration
type DatabaseConfig ¶
type DatabaseConfig struct {
Type string `mapstructure:"type" validate:"required,oneof=sqlite postgres mysql"`
Host string `mapstructure:"host" validate:"required_unless=Type sqlite,omitempty,hostname_rfc1123|ip"`
Port int `mapstructure:"port" validate:"required_unless=Type sqlite,omitempty,min=1,max=65535"`
Database string `mapstructure:"database" validate:"required,min=1"`
Username string `mapstructure:"username" validate:"required_unless=Type sqlite"`
Password string `mapstructure:"password" validate:"required_unless=Type sqlite"`
SSLMode string `mapstructure:"ssl_mode" validate:"omitempty,oneof=disable require verify-ca verify-full"`
MaxOpenConns int `mapstructure:"max_open_conns" validate:"min=1,max=100"`
MaxIdleConns int `mapstructure:"max_idle_conns" validate:"min=1,max=50"`
ConnMaxLifetime time.Duration `mapstructure:"conn_max_lifetime" validate:"min=1m"`
MigrationsPath string `mapstructure:"migrations_path" validate:"required,dir"`
}
DatabaseConfig contains database configuration
type DependencyGraphConfig ¶
type DependencyGraphConfig struct {
Enabled bool `mapstructure:"enabled"`
MaxDepth int `mapstructure:"max_depth" validate:"min=1,max=20"`
TransitiveAnalysis bool `mapstructure:"transitive_analysis"`
ConfusionDetection bool `mapstructure:"confusion_detection"`
SupplyChainRiskAnalysis bool `mapstructure:"supply_chain_risk_analysis"`
}
DependencyGraphConfig contains dependency graph analysis configuration
type DiscoveryCacheConfig ¶
type DiscoveryCacheConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
TTL time.Duration `yaml:"ttl" json:"ttl"`
Backend string `yaml:"backend" json:"backend"` // memory, redis, database
}
DiscoveryCacheConfig holds discovery caching configuration
type DiscoveryConfig ¶
type DiscoveryConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Interval time.Duration `yaml:"interval" json:"interval"`
MaxReposPerPlatform int `yaml:"max_repos_per_platform" json:"max_repos_per_platform"`
Workers int `yaml:"workers" json:"workers"`
Timeout time.Duration `yaml:"timeout" json:"timeout"`
Platforms []PlatformDiscoveryConfig `yaml:"platforms" json:"platforms"`
Cache DiscoveryCacheConfig `yaml:"cache" json:"cache"`
}
DiscoveryConfig holds repository discovery configuration
type DocumentationConfig ¶
type DocumentationConfig struct {
Enabled bool `mapstructure:"enabled"`
Path string `mapstructure:"path" validate:"required_if=Enabled true,omitempty,min=1"`
Title string `mapstructure:"title" validate:"required_if=Enabled true,omitempty,min=1"`
Version string `mapstructure:"version" validate:"required_if=Enabled true,omitempty,min=1"`
}
DocumentationConfig contains API documentation configuration
type EmailDelivery ¶
type EmailDelivery struct {
Enabled bool `yaml:"enabled" json:"enabled"`
SMTP SMTPConfig `yaml:"smtp" json:"smtp"`
From string `yaml:"from" json:"from"`
Subject string `yaml:"subject" json:"subject"`
Template string `yaml:"template" json:"template"`
}
EmailDelivery holds email delivery configuration
type EncryptionConfig ¶
type EncryptionConfig struct {
Key string `mapstructure:"key" validate:"required,min=32"`
Algorithm string `mapstructure:"algorithm" validate:"required,oneof=aes-256-gcm chacha20-poly1305"`
}
EncryptionConfig contains encryption configuration
type EndpointRateLimit ¶
type EndpointRateLimit struct {
Path string `yaml:"path" json:"path"`
Method string `yaml:"method" json:"method"`
Requests int `yaml:"requests" json:"requests"`
Window time.Duration `yaml:"window" json:"window"`
}
EndpointRateLimit holds endpoint-specific rate limiting
type EnterpriseConfig ¶
type EnterpriseConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
License LicenseConfig `yaml:"license" json:"license"`
Cache *CacheConfig `yaml:"cache" json:"cache"`
Monitoring interface{} `yaml:"monitoring" json:"monitoring"` // Removed monitoring dependency
EnterpriseSecurity EnterpriseSecurityConfig `yaml:"enterprise_security" json:"enterprise_security"`
Audit AuditConfig `yaml:"audit" json:"audit"`
EnterpriseRateLimit EnterpriseRateLimitConfig `yaml:"enterprise_rate_limit" json:"enterprise_rate_limit"`
SSO SSOConfig `yaml:"sso" json:"sso"`
Reporting ReportingConfig `yaml:"reporting" json:"reporting"`
Repository RepositoryConfig `yaml:"repository" json:"repository"`
}
EnterpriseConfig holds enterprise-specific configuration
func DefaultEnterpriseConfig ¶
func DefaultEnterpriseConfig() *EnterpriseConfig
DefaultEnterpriseConfig returns default enterprise configuration
func (*EnterpriseConfig) GetMaxScans ¶
func (ec *EnterpriseConfig) GetMaxScans() int
GetMaxScans returns the maximum number of scans allowed
func (*EnterpriseConfig) GetMaxUsers ¶
func (ec *EnterpriseConfig) GetMaxUsers() int
GetMaxUsers returns the maximum number of users allowed
func (*EnterpriseConfig) IsFeatureEnabled ¶
func (ec *EnterpriseConfig) IsFeatureEnabled(feature string) bool
IsFeatureEnabled checks if a specific feature is enabled
func (*EnterpriseConfig) Validate ¶
func (ec *EnterpriseConfig) Validate() error
Validate validates the enterprise configuration
type EnterpriseEncryptionConfig ¶
type EnterpriseEncryptionConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Algorithm string `yaml:"algorithm" json:"algorithm"` // "AES-256-GCM", "ChaCha20-Poly1305"
KeyFile string `yaml:"key_file" json:"key_file"`
Rotation time.Duration `yaml:"rotation" json:"rotation"`
}
EnterpriseEncryptionConfig holds encryption settings
type EnterpriseJWTConfig ¶
type EnterpriseJWTConfig struct {
Secret string `yaml:"secret" json:"-"`
Expiration time.Duration `yaml:"expiration" json:"expiration"`
Issuer string `yaml:"issuer" json:"issuer"`
Audience string `yaml:"audience" json:"audience"`
}
EnterpriseJWTConfig holds JWT configuration
type EnterpriseRateLimitConfig ¶
type EnterpriseRateLimitConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Global GlobalRateLimit `yaml:"global" json:"global"`
PerUser PerUserRateLimit `yaml:"per_user" json:"per_user"`
PerIP PerIPRateLimit `yaml:"per_ip" json:"per_ip"`
Endpoints []EndpointRateLimit `yaml:"endpoints" json:"endpoints"`
}
EnterpriseRateLimitConfig holds rate limiting configuration
type EnterpriseSecurityConfig ¶
type EnterpriseSecurityConfig struct {
EnterpriseEncryption EnterpriseEncryptionConfig `yaml:"encryption" json:"encryption"`
Authentication AuthConfig `yaml:"authentication" json:"authentication"`
Authorization AuthzConfig `yaml:"authorization" json:"authorization"`
EnterpriseTLS EnterpriseTLSConfig `yaml:"tls" json:"tls"`
Secrets SecretsConfig `yaml:"secrets" json:"secrets"`
}
EnterpriseSecurityConfig holds security-related configuration
type EnterpriseTLSConfig ¶
type EnterpriseTLSConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
CertFile string `yaml:"cert_file" json:"cert_file"`
KeyFile string `yaml:"key_file" json:"key_file"`
CAFile string `yaml:"ca_file" json:"ca_file"`
MinVersion string `yaml:"min_version" json:"min_version"`
CipherSuites []string `yaml:"cipher_suites" json:"cipher_suites"`
}
EnterpriseTLSConfig holds TLS configuration
type Environment ¶
type Environment string
Environment represents the application environment
const ( EnvDevelopment Environment = "development" EnvTesting Environment = "testing" EnvStaging Environment = "staging" EnvProduction Environment = "production" )
type EnvironmentDetector ¶
type EnvironmentDetector struct{}
EnvironmentDetector detects runtime environment
func (*EnvironmentDetector) DetectEnvironment ¶
func (ed *EnvironmentDetector) DetectEnvironment() *EnvironmentInfo
DetectEnvironment detects the current runtime environment
type EnvironmentInfo ¶
type EnvironmentInfo struct {
IsCI bool
IsContainer bool
IsProduction bool
CPUCores int
MemoryGB int
IsCloudEnv bool
}
EnvironmentInfo contains detected environment characteristics
type FeatureConfig ¶
type FeatureConfig struct {
MLScoring bool `mapstructure:"ml_scoring"`
AdvancedMetrics bool `mapstructure:"advanced_metrics"`
Caching bool `mapstructure:"caching"`
AsyncProcessing bool `mapstructure:"async_processing"`
Webhooks bool `mapstructure:"webhooks"`
BulkScanning bool `mapstructure:"bulk_scanning"`
HistoricalData bool `mapstructure:"historical_data"`
ExperimentalAPIs bool `mapstructure:"experimental_apis"`
}
FeatureConfig contains feature flags
type FeatureStoreConfig ¶
type FeatureStoreConfig struct {
Enabled bool `mapstructure:"enabled"`
Provider string `mapstructure:"provider" validate:"required_if=Enabled true,oneof=redis postgres"`
Connection string `mapstructure:"connection" validate:"required_if=Enabled true"`
TTL time.Duration `mapstructure:"ttl" validate:"min=1m"`
}
FeatureStoreConfig contains feature store configuration
type FileAuditConfig ¶
type FileAuditConfig struct {
Path string `yaml:"path" json:"path"`
MaxSize int64 `yaml:"max_size" json:"max_size"`
MaxBackups int `yaml:"max_backups" json:"max_backups"`
MaxAge int `yaml:"max_age" json:"max_age"`
}
FileAuditConfig holds file-based audit configuration
type FilterConfig ¶
type FilterConfig struct {
Name string `mapstructure:"name" validate:"required"`
Type string `mapstructure:"type" validate:"required,oneof=severity package_name threat_type"`
Condition string `mapstructure:"condition" validate:"required,oneof=equals contains regex"`
Value interface{} `mapstructure:"value" validate:"required"`
Metadata map[string]interface{} `mapstructure:"metadata"`
}
FilterConfig contains filter configuration
type GCPSecretsConfig ¶
type GCPSecretsConfig struct {
ProjectID string `yaml:"project_id" json:"project_id"`
Credentials string `yaml:"credentials" json:"credentials"`
}
GCPSecretsConfig holds Google Secret Manager configuration
type GlobalRateLimit ¶
type GlobalRateLimit struct {
Requests int `yaml:"requests" json:"requests"`
Window time.Duration `yaml:"window" json:"window"`
}
GlobalRateLimit holds global rate limiting settings
type GlobalRateLimitConfig ¶
type GlobalRateLimitConfig struct {
Enabled bool `mapstructure:"enabled"`
RPS int `mapstructure:"rps"`
RequestsPerSecond int `mapstructure:"requests_per_second"`
Burst int `mapstructure:"burst"`
BurstSize int `mapstructure:"burst_size"`
}
GlobalRateLimitConfig contains global rate limiting configuration
type GlobalRepositoryFilters ¶
type GlobalRepositoryFilters struct {
IncludePrivate bool `yaml:"include_private" json:"include_private"`
IncludeArchived bool `yaml:"include_archived" json:"include_archived"`
IncludeForks bool `yaml:"include_forks" json:"include_forks"`
MinStars int `yaml:"min_stars" json:"min_stars"`
Languages []string `yaml:"languages" json:"languages"`
ExcludePatterns []string `yaml:"exclude_patterns" json:"exclude_patterns"`
}
GlobalRepositoryFilters holds global filtering options
type GraphDatabaseConfig ¶
type GraphDatabaseConfig struct {
Enabled bool `mapstructure:"enabled"`
Type string `mapstructure:"type" validate:"required_if=Enabled true,omitempty,oneof=neo4j arangodb"`
Host string `mapstructure:"host" validate:"required_if=Enabled true,omitempty,hostname_rfc1123|ip"`
Port int `mapstructure:"port" validate:"required_if=Enabled true,omitempty,min=1,max=65535"`
Database string `mapstructure:"database" validate:"required_if=Enabled true,omitempty,min=1"`
Username string `mapstructure:"username" validate:"required_if=Enabled true,omitempty,min=1"`
Password string `mapstructure:"password" validate:"required_if=Enabled true,omitempty,min=1"`
}
GraphDatabaseConfig contains graph database configuration
type HoneypotDetectionConfig ¶
type HoneypotDetectionConfig struct {
Enabled bool `mapstructure:"enabled"`
PackageTrapDetection bool `mapstructure:"package_trap_detection"`
AuthenticityValidation bool `mapstructure:"authenticity_validation"`
ConfidenceThreshold float64 `mapstructure:"confidence_threshold" validate:"min=0,max=1"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
}
HoneypotDetectionConfig contains honeypot detection configuration
type IntegrationsConfig ¶
type IntegrationsConfig struct {
Enabled bool `mapstructure:"enabled"`
Connectors map[string]ConnectorConfig `mapstructure:"connectors"`
EventRouting map[string][]string `mapstructure:"event_routing"`
Filters []FilterConfig `mapstructure:"filters"`
}
IntegrationsConfig contains integrations configuration
type JWTConfig ¶
type JWTConfig struct {
Enabled bool `mapstructure:"enabled"`
Secret string `mapstructure:"secret" validate:"required_if=Enabled true,omitempty,min=32"`
Expiration time.Duration `mapstructure:"expiration" validate:"required_if=Enabled true,omitempty,min=1m"`
RefreshExpiration time.Duration `mapstructure:"refresh_expiration" validate:"required_if=Enabled true,omitempty,min=1h"`
Issuer string `mapstructure:"issuer" validate:"required_if=Enabled true,omitempty,min=1"`
Audience string `mapstructure:"audience" validate:"required_if=Enabled true,omitempty,min=1"`
}
JWTConfig contains JWT configuration
type L1CacheConfig ¶
type L1CacheConfig struct {
MaxSize int64 `yaml:"max_size" json:"max_size"`
MaxEntries int `yaml:"max_entries" json:"max_entries"`
TTL time.Duration `yaml:"ttl" json:"ttl"`
EvictionPolicy string `yaml:"eviction_policy" json:"eviction_policy"`
}
L1CacheConfig holds L1 cache configuration
type L2CacheConfig ¶
type L2CacheConfig struct {
KeyPrefix string `yaml:"key_prefix" json:"key_prefix"`
TTL time.Duration `yaml:"ttl" json:"ttl"`
MaxSize int64 `yaml:"max_size" json:"max_size"`
Compression bool `yaml:"compression" json:"compression"`
}
L2CacheConfig holds L2 cache configuration
type L3CacheConfig ¶
type L3CacheConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
StoragePath string `yaml:"storage_path" json:"storage_path"`
TTL time.Duration `yaml:"ttl" json:"ttl"`
MaxSize int64 `yaml:"max_size" json:"max_size"`
}
L3CacheConfig holds L3 cache configuration
type LDAPConfig ¶
type LDAPConfig struct {
Host string `yaml:"host" json:"host"`
Port int `yaml:"port" json:"port"`
BindDN string `yaml:"bind_dn" json:"bind_dn"`
BindPassword string `yaml:"bind_password" json:"-"`
BaseDN string `yaml:"base_dn" json:"base_dn"`
UserFilter string `yaml:"user_filter" json:"user_filter"`
GroupFilter string `yaml:"group_filter" json:"group_filter"`
TLS bool `yaml:"tls" json:"tls"`
}
LDAPConfig holds LDAP configuration
type LicenseConfig ¶
type LicenseConfig struct {
Key string `yaml:"key" json:"key"`
Type string `yaml:"type" json:"type"` // "trial", "standard", "premium", "enterprise"
ExpiresAt time.Time `yaml:"expires_at" json:"expires_at"`
MaxUsers int `yaml:"max_users" json:"max_users"`
MaxScans int `yaml:"max_scans" json:"max_scans"`
Features []string `yaml:"features" json:"features"`
Validated bool `yaml:"-" json:"-"`
}
LicenseConfig holds license configuration
type LoadBalancerConfig ¶
type LoadBalancerConfig struct {
Strategy string `yaml:"strategy" json:"strategy"`
HealthCheckPath string `yaml:"health_check_path" json:"health_check_path"`
HealthCheckInterval time.Duration `yaml:"health_check_interval" json:"health_check_interval"`
HealthCheckTimeout time.Duration `yaml:"health_check_timeout" json:"health_check_timeout"`
MaxRetries int `yaml:"max_retries" json:"max_retries"`
RetryDelay time.Duration `yaml:"retry_delay" json:"retry_delay"`
}
LoadBalancerConfig holds load balancer configuration
type LoggingConfig ¶
type LoggingConfig struct {
Level string `mapstructure:"level" validate:"required,oneof=debug info warn error"`
Format string `mapstructure:"format" validate:"required,oneof=json text"`
Output string `mapstructure:"output" validate:"required,oneof=stdout stderr file"`
File string `mapstructure:"file" validate:"required_if=Output file"`
MaxSize int `mapstructure:"max_size" validate:"min=1,max=1000"`
MaxBackups int `mapstructure:"max_backups" validate:"min=1,max=100"`
MaxAge int `mapstructure:"max_age" validate:"min=1,max=365"`
Compress bool `mapstructure:"compress"`
}
LoggingConfig contains logging configuration
type MFAConfig ¶
type MFAConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Methods []string `yaml:"methods" json:"methods"` // "totp", "sms", "email"
Required bool `yaml:"required" json:"required"`
}
MFAConfig holds multi-factor authentication configuration
type MLAnalysisConfig ¶
type MLAnalysisConfig struct {
Enabled bool `mapstructure:"enabled"`
ModelPath string `mapstructure:"model_path" validate:"required_if=Enabled true"`
Threshold float64 `mapstructure:"threshold" validate:"min=0,max=1"`
SimilarityThreshold float64 `mapstructure:"similarity_threshold" validate:"min=0,max=1"`
MaliciousThreshold float64 `mapstructure:"malicious_threshold" validate:"min=0,max=1"`
ReputationThreshold float64 `mapstructure:"reputation_threshold" validate:"min=0,max=1"`
BatchSize int `mapstructure:"batch_size" validate:"min=1,max=1000"`
MaxFeatures int `mapstructure:"max_features" validate:"min=1"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
CacheEmbeddings bool `mapstructure:"cache_embeddings"`
ParallelProcessing bool `mapstructure:"parallel_processing"`
GPUAcceleration bool `mapstructure:"gpu_acceleration"`
FeatureStore FeatureStoreConfig `mapstructure:"feature_store"`
ModelUpdates ModelUpdatesConfig `mapstructure:"model_updates"`
}
MLAnalysisConfig contains ML analysis configuration
type MLConfig ¶
type MLConfig struct {
Enabled bool `mapstructure:"enabled"`
ModelPath string `mapstructure:"model_path" validate:"required_if=Enabled true,omitempty,file"`
Threshold float64 `mapstructure:"threshold" validate:"min=0,max=1"`
BatchSize int `mapstructure:"batch_size" validate:"min=1,max=1000"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
CacheSize int `mapstructure:"cache_size" validate:"min=100,max=10000"`
UpdateInterval time.Duration `mapstructure:"update_interval" validate:"min=1h"`
MLModelConfig MLModelConfig `mapstructure:"model_config"`
}
MLConfig contains machine learning configuration
type MLModelConfig ¶
type MLModelConfig struct {
Enabled bool `mapstructure:"enabled"`
Threshold float64 `mapstructure:"threshold" validate:"min=0,max=1"`
Type string `mapstructure:"type" validate:"required,oneof=tensorflow pytorch sklearn"`
Version string `mapstructure:"version"`
Parameters map[string]interface{} `mapstructure:"parameters"`
Features []string `mapstructure:"features"`
Preprocessing PreprocessingConfig `mapstructure:"preprocessing"`
Postprocessing PostprocessingConfig `mapstructure:"postprocessing"`
}
MLModelConfig contains ML model configuration
type MLServiceConfig ¶
type MLServiceConfig struct {
Enabled bool `mapstructure:"enabled"`
Endpoint string `mapstructure:"endpoint" validate:"required_if=Enabled true,url"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
Retries int `mapstructure:"retries" validate:"min=0,max=10"`
APIKey string `mapstructure:"api_key"`
BatchSize int `mapstructure:"batch_size" validate:"min=1,max=1000"`
}
MLServiceConfig contains ML service configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages application configuration
func (*Manager) GetEnvironment ¶
func (m *Manager) GetEnvironment() Environment
GetEnvironment returns the current environment
func (*Manager) IsDevelopment ¶
IsDevelopment returns true if running in development environment
func (*Manager) IsProduction ¶
IsProduction returns true if running in production environment
type MetricsConfig ¶
type MetricsConfig struct {
Enabled bool `mapstructure:"enabled"`
Provider string `mapstructure:"provider" validate:"required_if=Enabled true,omitempty,oneof=prometheus statsd"`
Address string `mapstructure:"address" validate:"required_if=Enabled true,omitempty"`
Namespace string `mapstructure:"namespace" validate:"required_if=Enabled true,omitempty,min=1"`
Interval time.Duration `mapstructure:"interval" validate:"min=1s"`
Buckets []float64 `mapstructure:"buckets"`
}
MetricsConfig contains metrics configuration
type ModelUpdatesConfig ¶
type ModelUpdatesConfig struct {
Enabled bool `mapstructure:"enabled"`
Interval time.Duration `mapstructure:"interval" validate:"min=1h"`
Source string `mapstructure:"source" validate:"required_if=Enabled true"`
AutoApply bool `mapstructure:"auto_apply"`
}
ModelUpdatesConfig contains model updates configuration
type MonitoringConfig ¶
type MonitoringConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Interval time.Duration `yaml:"interval" json:"interval"`
Endpoint string `yaml:"endpoint" json:"endpoint"`
Timeout time.Duration `yaml:"timeout" json:"timeout"`
Retries int `yaml:"retries" json:"retries"`
Metrics []string `yaml:"metrics" json:"metrics"`
}
MonitoringConfig holds monitoring configuration
type OAuth2Config ¶
type OAuth2Config struct {
ClientID string `yaml:"client_id" json:"client_id"`
ClientSecret string `yaml:"client_secret" json:"-"`
RedirectURL string `yaml:"redirect_url" json:"redirect_url"`
Scopes []string `yaml:"scopes" json:"scopes"`
AuthURL string `yaml:"auth_url" json:"auth_url"`
TokenURL string `yaml:"token_url" json:"token_url"`
UserInfoURL string `yaml:"user_info_url" json:"user_info_url"`
}
OAuth2Config holds OAuth2 configuration
type OutputConfig ¶
type OutputConfig struct {
Format string `yaml:"format" json:"format"` // sarif, spdx, cyclonedx, json, csv
Destination string `yaml:"destination" json:"destination"`
Template string `yaml:"template" json:"template"`
Options map[string]interface{} `yaml:"options" json:"options"`
Enabled bool `yaml:"enabled" json:"enabled"`
}
OutputConfig holds output configuration
type PasswordPolicyConfig ¶
type PasswordPolicyConfig struct {
MinLength int `mapstructure:"min_length" validate:"min=8,max=128"`
RequireUpper bool `mapstructure:"require_upper"`
RequireLower bool `mapstructure:"require_lower"`
RequireDigit bool `mapstructure:"require_digit"`
RequireSymbol bool `mapstructure:"require_symbol"`
}
PasswordPolicyConfig contains password policy configuration
type PerIPRateLimit ¶
type PerIPRateLimit struct {
Requests int `yaml:"requests" json:"requests"`
Window time.Duration `yaml:"window" json:"window"`
}
PerIPRateLimit holds per-IP rate limiting settings
type PerUserRateLimit ¶
type PerUserRateLimit struct {
Requests int `yaml:"requests" json:"requests"`
Window time.Duration `yaml:"window" json:"window"`
}
PerUserRateLimit holds per-user rate limiting settings
type PlatformConfig ¶
type PlatformConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
BaseURL string `yaml:"base_url" json:"base_url"`
Auth AuthenticationConfig `yaml:"auth" json:"auth"`
Timeout time.Duration `yaml:"timeout" json:"timeout"`
RateLimit RepositoryRateLimitConfig `yaml:"rate_limit" json:"rate_limit"`
Settings map[string]interface{} `yaml:"settings" json:"settings"`
Targets []ScanTarget `yaml:"targets" json:"targets"`
}
PlatformConfig holds platform-specific configuration
type PlatformDiscoveryConfig ¶
type PlatformDiscoveryConfig struct {
Platform string `yaml:"platform" json:"platform"`
Enabled bool `yaml:"enabled" json:"enabled"`
Organizations []string `yaml:"organizations" json:"organizations"`
Users []string `yaml:"users" json:"users"`
Groups []string `yaml:"groups" json:"groups"`
Projects []string `yaml:"projects" json:"projects"`
Repositories []string `yaml:"repositories" json:"repositories"`
SearchQueries []string `yaml:"search_queries" json:"search_queries"`
Filter *RepositoryFilter `yaml:"filter" json:"filter"`
}
PlatformDiscoveryConfig holds platform-specific discovery settings
type PluginConfig ¶
type PluginConfig struct {
Name string `mapstructure:"name" validate:"required"`
Enabled bool `mapstructure:"enabled"`
Path string `mapstructure:"path" validate:"required_if=Enabled true"`
Config map[string]string `mapstructure:"config"`
Settings map[string]interface{} `mapstructure:"settings"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
Retries int `mapstructure:"retries" validate:"min=0,max=10"`
}
PluginConfig contains individual plugin configuration
type PluginEntry ¶
type PluginEntry struct {
Name string `mapstructure:"name" validate:"required"`
Path string `mapstructure:"path" validate:"required"`
Version string `mapstructure:"version" validate:"required"`
Description string `mapstructure:"description"`
Author string `mapstructure:"author"`
Enabled bool `mapstructure:"enabled"`
Config map[string]interface{} `mapstructure:"config"`
}
PluginEntry contains plugin entry information
type PluginsConfig ¶
type PluginsConfig struct {
Enabled bool `mapstructure:"enabled"`
Directory string `mapstructure:"directory" validate:"required_if=Enabled true"`
PluginDirectory string `mapstructure:"plugin_directory" validate:"required_if=Enabled true"`
AutoLoad bool `mapstructure:"auto_load"`
Plugins map[string]PluginConfig `mapstructure:"plugins"`
Webhooks WebhookConfig `mapstructure:"webhooks"`
CICD CICDConfig `mapstructure:"cicd"`
}
PluginsConfig contains plugins configuration
type PoliciesConfig ¶
type PoliciesConfig struct {
FailOnThreats bool `mapstructure:"fail_on_threats"`
MinThreatLevel string `mapstructure:"min_threat_level" validate:"oneof=low medium high critical"`
}
PoliciesConfig contains policy configuration
type PolicyAction ¶
type PolicyAction struct {
Type string `yaml:"type" json:"type"` // block, warn, notify, approve
Parameters map[string]interface{} `yaml:"parameters" json:"parameters"`
}
PolicyAction represents a policy action
type PolicyCondition ¶
type PolicyCondition struct {
Field string `yaml:"field" json:"field"`
Operator string `yaml:"operator" json:"operator"` // eq, ne, gt, lt, gte, lte, in, contains
Value interface{} `yaml:"value" json:"value"`
}
PolicyCondition represents a policy condition
type PolicyConfig ¶
type PolicyConfig struct {
Name string `yaml:"name" json:"name"`
Effect string `yaml:"effect" json:"effect"` // "allow", "deny"
Actions []string `yaml:"actions" json:"actions"`
Resources []string `yaml:"resources" json:"resources"`
Conditions map[string]string `yaml:"conditions" json:"conditions"`
}
PolicyConfig defines an authorization policy
type PostprocessingConfig ¶
type PostprocessingConfig struct {
ThresholdAdjustment bool `mapstructure:"threshold_adjustment"`
Calibration bool `mapstructure:"calibration"`
CustomSteps []ProcessingStep `mapstructure:"custom_steps"`
}
PostprocessingConfig contains postprocessing configuration
type PreprocessingConfig ¶
type PreprocessingConfig struct {
Normalization bool `mapstructure:"normalization"`
Scaling string `mapstructure:"scaling" validate:"oneof=standard minmax robust"`
FeatureSelection bool `mapstructure:"feature_selection"`
CustomSteps []ProcessingStep `mapstructure:"custom_steps"`
}
PreprocessingConfig contains preprocessing configuration
type PrivateConfig ¶
type PrivateConfig struct {
Namespaces []string `mapstructure:"namespaces"`
}
PrivateConfig contains private registry configuration
type ProcessingStep ¶
type ProcessingStep struct {
Name string `mapstructure:"name" validate:"required"`
Type string `mapstructure:"type" validate:"required"`
Parameters map[string]interface{} `mapstructure:"parameters"`
}
ProcessingStep contains processing step configuration
type ProjectDetector ¶
type ProjectDetector struct{}
ProjectDetector detects project characteristics
func (*ProjectDetector) DetectProject ¶
func (pd *ProjectDetector) DetectProject(projectPath string) (*ProjectInfo, error)
DetectProject analyzes the project directory and returns project information
type ProjectInfo ¶
type ProjectInfo struct {
Type ProjectType
Languages []string
Size ProjectSize
Dependencies int
HasCI bool
IsMonorepo bool
Framework string
}
ProjectInfo contains detected project characteristics
type ProjectSize ¶
type ProjectSize string
ProjectSize represents the project size category
const ( SizeSmall ProjectSize = "small" // < 100 files SizeMedium ProjectSize = "medium" // 100-1000 files SizeLarge ProjectSize = "large" // 1000-10000 files SizeHuge ProjectSize = "huge" // > 10000 files )
type ProjectType ¶
type ProjectType string
ProjectType represents the detected project type
const ( ProjectTypeNodeJS ProjectType = "nodejs" ProjectTypePython ProjectType = "python" ProjectTypeGo ProjectType = "go" ProjectTypeRust ProjectType = "rust" ProjectTypeJava ProjectType = "java" ProjectTypeRuby ProjectType = "ruby" ProjectTypePHP ProjectType = "php" ProjectTypeMultiLang ProjectType = "multilang" ProjectTypeUnknown ProjectType = "unknown" )
type QueueConfig ¶
type QueueConfig struct {
MaxRetries int `yaml:"max_retries" json:"max_retries"`
RetryDelay time.Duration `yaml:"retry_delay" json:"retry_delay"`
VisibilityTimeout time.Duration `yaml:"visibility_timeout" json:"visibility_timeout"`
PollInterval time.Duration `yaml:"poll_interval" json:"poll_interval"`
DeadLetterQueue string `yaml:"dead_letter_queue" json:"dead_letter_queue"`
BatchSize int `yaml:"batch_size" json:"batch_size"`
}
QueueConfig holds queue configuration
type RESTAPIConfig ¶
type RESTAPIConfig struct {
Enabled bool `mapstructure:"enabled"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
BasePath string `mapstructure:"base_path"`
Prefix string `mapstructure:"prefix"`
Version string `mapstructure:"version"`
Versioning APIVersioning `mapstructure:"versioning"`
MaxBodySize int64 `mapstructure:"max_body_size"`
CORS *CORSConfig `mapstructure:"cors"`
RateLimiting *APIRateLimiting `mapstructure:"rate_limiting"`
Authentication *APIAuthentication `mapstructure:"authentication"`
Documentation APIDocumentation `mapstructure:"documentation"`
}
RESTAPIConfig contains REST API configuration
type RateLimitConfig ¶
type RateLimitConfig struct {
Enabled bool `mapstructure:"enabled"`
Requests int `mapstructure:"requests" validate:"required_if=Enabled true,omitempty,min=1"`
Window time.Duration `mapstructure:"window" validate:"required_if=Enabled true,omitempty,min=1s"`
Burst int `mapstructure:"burst" validate:"required_if=Enabled true,omitempty,min=1"`
SkipPaths []string `mapstructure:"skip_paths"`
Headers bool `mapstructure:"headers"`
}
RateLimitConfig contains rate limiting configuration
type RedisConfig ¶
type RedisConfig struct {
Enabled bool `mapstructure:"enabled"`
Host string `mapstructure:"host" validate:"required_if=Enabled true,omitempty,hostname_rfc1123|ip"`
Port int `mapstructure:"port" validate:"required_if=Enabled true,omitempty,min=1,max=65535"`
Password string `mapstructure:"password"`
Database int `mapstructure:"database" validate:"min=0,max=15"`
PoolSize int `mapstructure:"pool_size" validate:"min=1,max=100"`
DialTimeout time.Duration `mapstructure:"dial_timeout" validate:"min=1s"`
ReadTimeout time.Duration `mapstructure:"read_timeout" validate:"min=1s"`
WriteTimeout time.Duration `mapstructure:"write_timeout" validate:"min=1s"`
IdleTimeout time.Duration `mapstructure:"idle_timeout" validate:"min=1m"`
TTL time.Duration `mapstructure:"ttl" validate:"min=1m"`
}
RedisConfig contains Redis configuration
type RegistriesConfig ¶
type RegistriesConfig []RegistryConfig
RegistriesConfig contains package registry configuration
type RegistryConfig ¶
type RegistryConfig struct {
Enabled bool `mapstructure:"enabled"`
URL string `mapstructure:"url" validate:"required_if=Enabled true,omitempty,url"`
APIKey string `mapstructure:"api_key"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
Private PrivateConfig `mapstructure:"private"`
}
RegistryConfig contains individual registry configuration
type ReportDelivery ¶
type ReportDelivery struct {
Email EmailDelivery `yaml:"email" json:"email"`
Webhook WebhookDelivery `yaml:"webhook" json:"webhook"`
S3 S3Delivery `yaml:"s3" json:"s3"`
}
ReportDelivery defines report delivery options
type ReportTemplate ¶
type ReportTemplate struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Format string `yaml:"format" json:"format"` // "pdf", "html", "csv", "json"
Query string `yaml:"query" json:"query"`
Parameters map[string]string `yaml:"parameters" json:"parameters"`
}
ReportTemplate defines a report template
type ReportingConfig ¶
type ReportingConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Scheduled []ScheduledReport `yaml:"scheduled" json:"scheduled"`
Templates []ReportTemplate `yaml:"templates" json:"templates"`
Delivery ReportDelivery `yaml:"delivery" json:"delivery"`
Retention time.Duration `yaml:"retention" json:"retention"`
}
ReportingConfig holds reporting configuration
type RepositoryConfig ¶
type RepositoryConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Platforms map[string]PlatformConfig `yaml:"platforms" json:"platforms"`
Discovery DiscoveryConfig `yaml:"discovery" json:"discovery"`
Scanning ScanningConfig `yaml:"scanning" json:"scanning"`
Webhooks RepositoryWebhookConfig `yaml:"webhooks" json:"webhooks"`
Filters GlobalRepositoryFilters `yaml:"filters" json:"filters"`
Scheduled []ScheduledRepositoryScan `yaml:"scheduled" json:"scheduled"`
}
RepositoryConfig holds repository scanning configuration
func DefaultRepositoryConfig ¶
func DefaultRepositoryConfig() *RepositoryConfig
DefaultRepositoryConfig returns default repository configuration
func (*RepositoryConfig) GetEnabledPlatforms ¶
func (rc *RepositoryConfig) GetEnabledPlatforms() []string
GetEnabledPlatforms returns a list of enabled platforms
func (*RepositoryConfig) GetPlatformConfig ¶
func (rc *RepositoryConfig) GetPlatformConfig(platform string) (*PlatformConfig, bool)
GetPlatformConfig returns configuration for a specific platform
func (*RepositoryConfig) IsWebhookEnabled ¶
func (rc *RepositoryConfig) IsWebhookEnabled(platform string) bool
IsWebhookEnabled checks if webhooks are enabled for a platform
func (*RepositoryConfig) Validate ¶
func (rc *RepositoryConfig) Validate() error
Validate validates the repository configuration
type RepositoryFilter ¶
type RepositoryFilter struct {
Languages []string `yaml:"languages" json:"languages"`
Topics []string `yaml:"topics" json:"topics"`
IncludePrivate bool `yaml:"include_private" json:"include_private"`
IncludeArchived bool `yaml:"include_archived" json:"include_archived"`
IncludeForks bool `yaml:"include_forks" json:"include_forks"`
MinStars int `yaml:"min_stars" json:"min_stars"`
MaxStars int `yaml:"max_stars" json:"max_stars"`
MinSize int64 `yaml:"min_size" json:"min_size"`
MaxSize int64 `yaml:"max_size" json:"max_size"`
NamePattern string `yaml:"name_pattern" json:"name_pattern"`
ExcludePatterns []string `yaml:"exclude_patterns" json:"exclude_patterns"`
CreatedAfter *time.Time `yaml:"created_after" json:"created_after"`
CreatedBefore *time.Time `yaml:"created_before" json:"created_before"`
UpdatedAfter *time.Time `yaml:"updated_after" json:"updated_after"`
UpdatedBefore *time.Time `yaml:"updated_before" json:"updated_before"`
}
RepositoryFilter holds repository filtering options
type RepositoryRateLimitConfig ¶
type RepositoryRateLimitConfig struct {
RequestsPerHour int `yaml:"requests_per_hour" json:"requests_per_hour"`
Burst int `yaml:"burst" json:"burst"`
RetryDelay time.Duration `yaml:"retry_delay" json:"retry_delay"`
MaxRetries int `yaml:"max_retries" json:"max_retries"`
}
RepositoryRateLimitConfig holds repository-specific rate limiting configuration
type RepositoryWebhookConfig ¶
type RepositoryWebhookConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Endpoint string `yaml:"endpoint" json:"endpoint"`
Secret string `yaml:"secret" json:"-"`
Events []string `yaml:"events" json:"events"`
Platforms map[string]WebhookPlatformConfig `yaml:"platforms" json:"platforms"`
Security WebhookSecurityConfig `yaml:"security" json:"security"`
}
RepositoryWebhookConfig holds repository webhook configuration
type RetentionPolicyConfig ¶
type RetentionPolicyConfig struct {
Enabled bool `mapstructure:"enabled"`
ScanResults time.Duration `mapstructure:"scan_results" validate:"min=24h"`
ThreatIntel time.Duration `mapstructure:"threat_intel" validate:"min=24h"`
DependencyGraphs time.Duration `mapstructure:"dependency_graphs" validate:"min=24h"`
BuildIntegrity time.Duration `mapstructure:"build_integrity" validate:"min=24h"`
ZeroDayFindings time.Duration `mapstructure:"zero_day_findings" validate:"min=24h"`
HoneypotDetections time.Duration `mapstructure:"honeypot_detections" validate:"min=24h"`
}
RetentionPolicyConfig contains data retention policy configuration
type RetryConfig ¶
type RetryConfig struct {
Enabled bool `mapstructure:"enabled"`
MaxAttempts int `mapstructure:"max_attempts" validate:"min=1,max=10"`
InitialDelay time.Duration `mapstructure:"initial_delay" validate:"min=1s"`
MaxDelay time.Duration `mapstructure:"max_delay" validate:"min=1s"`
BackoffFactor float64 `mapstructure:"backoff_factor" validate:"min=1.0,max=10.0"`
}
RetryConfig contains retry configuration
type RiskCalculationConfig ¶
type RiskCalculationConfig struct {
Enabled bool `mapstructure:"enabled"`
Weights RiskWeights `mapstructure:"weights"`
Thresholds RiskThresholds `mapstructure:"thresholds"`
Factors []string `mapstructure:"factors"`
CustomRules []CustomRiskRule `mapstructure:"custom_rules"`
}
RiskCalculationConfig contains risk calculation configuration
type RiskThresholds ¶
type RiskThresholds struct {
Low float64 `mapstructure:"low" validate:"min=0,max=1"`
Medium float64 `mapstructure:"medium" validate:"min=0,max=1"`
High float64 `mapstructure:"high" validate:"min=0,max=1"`
Critical float64 `mapstructure:"critical" validate:"min=0,max=1"`
}
RiskThresholds contains thresholds for risk levels
type RiskWeights ¶
type RiskWeights struct {
BuildIntegrity float64 `mapstructure:"build_integrity" validate:"min=0,max=1"`
ZeroDayThreats float64 `mapstructure:"zero_day_threats" validate:"min=0,max=1"`
ThreatIntel float64 `mapstructure:"threat_intel" validate:"min=0,max=1"`
HoneypotDetection float64 `mapstructure:"honeypot_detection" validate:"min=0,max=1"`
DependencyRisk float64 `mapstructure:"dependency_risk" validate:"min=0,max=1"`
}
RiskWeights contains weights for different risk factors
type RoleConfig ¶
type RoleConfig struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Permissions []string `yaml:"permissions" json:"permissions"`
Inherits []string `yaml:"inherits" json:"inherits"`
}
RoleConfig defines a role
type S3Delivery ¶
type S3Delivery struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Bucket string `yaml:"bucket" json:"bucket"`
Prefix string `yaml:"prefix" json:"prefix"`
Region string `yaml:"region" json:"region"`
AccessKey string `yaml:"access_key" json:"access_key"`
SecretKey string `yaml:"secret_key" json:"-"`
}
S3Delivery holds S3 delivery configuration
type SAMLConfig ¶
type SAMLConfig struct {
EntityID string `yaml:"entity_id" json:"entity_id"`
SSOURL string `yaml:"sso_url" json:"sso_url"`
Certificate string `yaml:"certificate" json:"certificate"`
PrivateKey string `yaml:"private_key" json:"-"`
MetadataURL string `yaml:"metadata_url" json:"metadata_url"`
}
SAMLConfig holds SAML configuration
type SMTPConfig ¶
type SMTPConfig struct {
Host string `yaml:"host" json:"host"`
Port int `yaml:"port" json:"port"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"-"`
TLS bool `yaml:"tls" json:"tls"`
}
SMTPConfig holds SMTP configuration
type SSOConfig ¶
type SSOConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Providers []SSOProvider `yaml:"providers" json:"providers"`
Default string `yaml:"default" json:"default"`
Mapping UserMapping `yaml:"mapping" json:"mapping"`
}
SSOConfig holds single sign-on configuration
type SSOProvider ¶
type SSOProvider struct {
Name string `yaml:"name" json:"name"`
Type string `yaml:"type" json:"type"` // "oidc", "saml", "oauth2"
Config map[string]interface{} `yaml:"config" json:"config"`
Enabled bool `yaml:"enabled" json:"enabled"`
}
SSOProvider defines an SSO provider
type ScanCacheConfig ¶
type ScanCacheConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
TTL time.Duration `yaml:"ttl" json:"ttl"`
Backend string `yaml:"backend" json:"backend"`
}
ScanCacheConfig holds scan caching configuration
type ScanFilterConfig ¶
type ScanFilterConfig struct {
FileSizeLimit int64 `yaml:"file_size_limit" json:"file_size_limit"`
ExcludePatterns []string `yaml:"exclude_patterns" json:"exclude_patterns"`
IncludePatterns []string `yaml:"include_patterns" json:"include_patterns"`
IncludeLanguages []string `yaml:"include_languages" json:"include_languages"`
ExcludeLanguages []string `yaml:"exclude_languages" json:"exclude_languages"`
}
ScanFilterConfig holds scan filtering configuration
type ScanPolicyConfig ¶
type ScanPolicyConfig struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Enabled bool `yaml:"enabled" json:"enabled"`
Conditions []PolicyCondition `yaml:"conditions" json:"conditions"`
Actions []PolicyAction `yaml:"actions" json:"actions"`
Metadata map[string]interface{} `yaml:"metadata" json:"metadata"`
}
ScanPolicyConfig holds scan policy configuration
type ScanTarget ¶
type ScanTarget struct {
Type string `yaml:"type" json:"type"` // organization, user, repository, search
Name string `yaml:"name" json:"name"`
Organization string `yaml:"organization" json:"organization"`
User string `yaml:"user" json:"user"`
Group string `yaml:"group" json:"group"`
Project string `yaml:"project" json:"project"`
Repositories []string `yaml:"repositories" json:"repositories"`
SearchQuery string `yaml:"search_query" json:"search_query"`
IncludeAll bool `yaml:"include_all" json:"include_all"`
Filter *RepositoryFilter `yaml:"filter" json:"filter"`
Metadata map[string]interface{} `yaml:"metadata" json:"metadata"`
}
ScanTarget represents a scanning target
type ScannerConfig ¶
type ScannerConfig struct {
MaxConcurrency int `mapstructure:"max_concurrency" validate:"min=1,max=50"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
RetryAttempts int `mapstructure:"retry_attempts" validate:"min=0,max=10"`
RetryDelay time.Duration `mapstructure:"retry_delay" validate:"min=1s"`
UserAgent string `mapstructure:"user_agent" validate:"required,min=1"`
IncludeDevDeps bool `mapstructure:"include_dev_deps"`
EnrichMetadata bool `mapstructure:"enrich_metadata"`
Registries RegistriesConfig `mapstructure:"registries"`
}
ScannerConfig contains scanner configuration
type ScanningConfig ¶
type ScanningConfig struct {
Concurrency ConcurrencyConfig `yaml:"concurrency" json:"concurrency"`
Timeouts TimeoutConfig `yaml:"timeouts" json:"timeouts"`
Cache ScanCacheConfig `yaml:"cache" json:"cache"`
Filters ScanFilterConfig `yaml:"filters" json:"filters"`
PackageManagers []string `yaml:"package_managers" json:"package_managers"`
ScanTypes []string `yaml:"scan_types" json:"scan_types"`
OutputFormats []string `yaml:"output_formats" json:"output_formats"`
Policies []ScanPolicyConfig `yaml:"policies" json:"policies"`
}
ScanningConfig holds scanning configuration
type ScheduledReport ¶
type ScheduledReport struct {
Name string `yaml:"name" json:"name"`
Template string `yaml:"template" json:"template"`
Schedule string `yaml:"schedule" json:"schedule"` // Cron expression
Recipients []string `yaml:"recipients" json:"recipients"`
Enabled bool `yaml:"enabled" json:"enabled"`
}
ScheduledReport defines a scheduled report
type ScheduledRepositoryScan ¶
type ScheduledRepositoryScan struct {
ID string `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"`
Description string `yaml:"description" json:"description"`
Enabled bool `yaml:"enabled" json:"enabled"`
Schedule string `yaml:"schedule" json:"schedule"` // Cron expression
Timezone string `yaml:"timezone" json:"timezone"`
Targets []ScanTarget `yaml:"targets" json:"targets"`
Options ScanningConfig `yaml:"options" json:"options"`
Output []OutputConfig `yaml:"output" json:"output"`
Policies []ScanPolicyConfig `yaml:"policies" json:"policies"`
Metadata map[string]interface{} `yaml:"metadata" json:"metadata"`
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
}
ScheduledRepositoryScan holds scheduled scan configuration
type SecretsConfig ¶
type SecretsConfig struct {
Provider string `yaml:"provider" json:"provider"` // "vault", "aws", "azure", "gcp"
Vault VaultConfig `yaml:"vault" json:"vault"`
AWS AWSSecretsConfig `yaml:"aws" json:"aws"`
Azure AzureSecretsConfig `yaml:"azure" json:"azure"`
GCP GCPSecretsConfig `yaml:"gcp" json:"gcp"`
}
SecretsConfig holds secrets management configuration
type SecurityConfig ¶
type SecurityConfig struct {
JWT JWTConfig `mapstructure:"jwt"`
APIKeys APIKeysConfig `mapstructure:"api_keys"`
Encryption EncryptionConfig `mapstructure:"encryption"`
PasswordPolicy PasswordPolicyConfig `mapstructure:"password_policy"`
CSRF CSRFConfig `mapstructure:"csrf"`
}
SecurityConfig contains security configuration
type SecurityPreset ¶
type SecurityPreset string
SecurityPreset represents predefined security configurations
const ( PresetQuick SecurityPreset = "quick" PresetBalanced SecurityPreset = "balanced" PresetThorough SecurityPreset = "thorough" PresetParanoid SecurityPreset = "paranoid" PresetEnterprise SecurityPreset = "enterprise" )
type ServerConfig ¶
type ServerConfig struct {
Host string `mapstructure:"host" validate:"required,hostname_rfc1123|ip"`
Port int `mapstructure:"port" validate:"required,min=1,max=65535"`
ReadTimeout time.Duration `mapstructure:"read_timeout" validate:"required,min=1s"`
WriteTimeout time.Duration `mapstructure:"write_timeout" validate:"required,min=1s"`
IdleTimeout time.Duration `mapstructure:"idle_timeout" validate:"required,min=1s"`
ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout" validate:"required,min=1s"`
TLS TLSConfig `mapstructure:"tls"`
CORS CORSConfig `mapstructure:"cors"`
}
ServerConfig contains HTTP server configuration
type SmartDefaultsEngine ¶
type SmartDefaultsEngine struct {
// contains filtered or unexported fields
}
SmartDefaultsEngine generates intelligent configuration defaults
func NewSmartDefaultsEngine ¶
func NewSmartDefaultsEngine() *SmartDefaultsEngine
NewSmartDefaultsEngine creates a new smart defaults engine
func (*SmartDefaultsEngine) DetectProject ¶
func (e *SmartDefaultsEngine) DetectProject(projectPath string) (*ProjectInfo, error)
DetectProject analyzes the project directory and returns project information
func (*SmartDefaultsEngine) GenerateConfig ¶
func (s *SmartDefaultsEngine) GenerateConfig(projectPath string, preset SecurityPreset) (*Config, error)
GenerateConfig generates an optimized configuration based on project analysis
type SupplyChainConfig ¶
type SupplyChainConfig struct {
Enabled bool `mapstructure:"enabled"`
BuildIntegrity BuildIntegrityConfig `mapstructure:"build_integrity"`
ZeroDayDetection ZeroDayDetectionConfig `mapstructure:"zero_day_detection"`
DependencyGraph DependencyGraphConfig `mapstructure:"dependency_graph"`
ThreatIntelligence ThreatIntelConfig `mapstructure:"threat_intelligence"`
HoneypotDetection HoneypotDetectionConfig `mapstructure:"honeypot_detection"`
RiskCalculation RiskCalculationConfig `mapstructure:"risk_calculation"`
DataStorage SupplyChainStorageConfig `mapstructure:"data_storage"`
}
SupplyChainConfig contains supply chain security configuration
type SupplyChainStorageConfig ¶
type SupplyChainStorageConfig struct {
Enabled bool `mapstructure:"enabled"`
GraphDatabase GraphDatabaseConfig `mapstructure:"graph_database"`
TimeSeriesDB TimeSeriesDBConfig `mapstructure:"time_series_db"`
RetentionPolicy RetentionPolicyConfig `mapstructure:"retention_policy"`
}
SupplyChainStorageConfig contains storage configuration for supply chain data
type SyslogAuditConfig ¶
type SyslogAuditConfig struct {
Network string `yaml:"network" json:"network"`
Address string `yaml:"address" json:"address"`
Facility string `yaml:"facility" json:"facility"`
Tag string `yaml:"tag" json:"tag"`
}
SyslogAuditConfig holds syslog audit configuration
type TLSConfig ¶
type TLSConfig struct {
Enabled bool `mapstructure:"enabled"`
CertFile string `mapstructure:"cert_file" validate:"required_if=Enabled true,omitempty,file"`
KeyFile string `mapstructure:"key_file" validate:"required_if=Enabled true,omitempty,file"`
CAFile string `mapstructure:"ca_file" validate:"omitempty,file"`
}
TLSConfig contains TLS configuration
type ThreatFeedConfig ¶
type ThreatFeedConfig struct {
Name string `mapstructure:"name" validate:"required"`
URL string `mapstructure:"url" validate:"required,url"`
Enabled bool `mapstructure:"enabled"`
Interval time.Duration `mapstructure:"interval" validate:"min=1m"`
APIKey string `mapstructure:"api_key"`
}
ThreatFeedConfig contains threat feed configuration
type ThreatIntelConfig ¶
type ThreatIntelConfig struct {
Enabled bool `mapstructure:"enabled"`
Sources []ThreatIntelSource `mapstructure:"sources"`
CacheEnabled bool `mapstructure:"cache_enabled"`
CacheTTL time.Duration `mapstructure:"cache_ttl" validate:"min=1m"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
Retries int `mapstructure:"retries" validate:"min=0,max=5"`
}
ThreatIntelConfig contains threat intelligence configuration
type ThreatIntelSource ¶
type ThreatIntelSource struct {
Name string `mapstructure:"name" validate:"required"`
Type string `mapstructure:"type" validate:"required,oneof=api feed database"`
Enabled bool `mapstructure:"enabled"`
URL string `mapstructure:"url" validate:"required_if=Type api,omitempty,url"`
APIKey string `mapstructure:"api_key"`
Headers map[string]string `mapstructure:"headers"`
Priority int `mapstructure:"priority" validate:"min=1,max=10"`
}
ThreatIntelSource contains threat intelligence source configuration
type ThreatIntelligenceConfig ¶
type ThreatIntelligenceConfig struct {
Enabled bool `mapstructure:"enabled"`
UpdateInterval time.Duration `mapstructure:"update_interval" validate:"min=1m"`
Feeds []ThreatFeedConfig `mapstructure:"feeds"`
Alerting AlertingConfig `mapstructure:"alerting"`
}
ThreatIntelligenceConfig contains threat intelligence configuration
type ThrottlingConfig ¶
type ThrottlingConfig struct {
Enabled bool `mapstructure:"enabled"`
MaxPerMinute int `mapstructure:"max_per_minute" validate:"min=1"`
CooldownPeriod time.Duration `mapstructure:"cooldown_period" validate:"min=1m"`
}
ThrottlingConfig contains throttling configuration
type TimeSeriesDBConfig ¶
type TimeSeriesDBConfig struct {
Enabled bool `mapstructure:"enabled"`
Type string `mapstructure:"type" validate:"required_if=Enabled true,omitempty,oneof=influxdb prometheus"`
Host string `mapstructure:"host" validate:"required_if=Enabled true,omitempty,hostname_rfc1123|ip"`
Port int `mapstructure:"port" validate:"required_if=Enabled true,omitempty,min=1,max=65535"`
Database string `mapstructure:"database" validate:"required_if=Enabled true,omitempty,min=1"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Organization string `mapstructure:"organization"`
Bucket string `mapstructure:"bucket"`
Token string `mapstructure:"token"`
}
TimeSeriesDBConfig contains time series database configuration
type TimeoutConfig ¶
type TimeoutConfig struct {
RepositoryClone time.Duration `yaml:"repository_clone" json:"repository_clone"`
PackageAnalysis time.Duration `yaml:"package_analysis" json:"package_analysis"`
TotalScan time.Duration `yaml:"total_scan" json:"total_scan"`
APIRequest time.Duration `yaml:"api_request" json:"api_request"`
}
TimeoutConfig holds timeout settings
type TypoDetectionConfig ¶
type TypoDetectionConfig struct {
Enabled bool `mapstructure:"enabled"`
Threshold float64 `mapstructure:"threshold" validate:"min=0,max=1"`
SimilarityThreshold float64 `mapstructure:"similarity_threshold" validate:"min=0,max=1"`
EditDistanceThreshold int `mapstructure:"edit_distance_threshold" validate:"min=1"`
MaxDistance int `mapstructure:"max_distance" validate:"min=1"`
PhoneticMatching bool `mapstructure:"phonetic_matching"`
CheckSimilarNames bool `mapstructure:"check_similar_names"`
CheckHomoglyphs bool `mapstructure:"check_homoglyphs"`
DictionaryPath string `mapstructure:"dictionary_path"`
}
TypoDetectionConfig contains typo detection configuration
type UserMapping ¶
type UserMapping struct {
Username string `yaml:"username" json:"username"`
Email string `yaml:"email" json:"email"`
Name string `yaml:"name" json:"name"`
Groups string `yaml:"groups" json:"groups"`
Roles string `yaml:"roles" json:"roles"`
}
UserMapping defines how to map SSO user attributes
type VaultConfig ¶
type VaultConfig struct {
Address string `yaml:"address" json:"address"`
Token string `yaml:"token" json:"-"`
Namespace string `yaml:"namespace" json:"namespace"`
Path string `yaml:"path" json:"path"`
}
VaultConfig holds HashiCorp Vault configuration
type WebhookAuditConfig ¶
type WebhookAuditConfig struct {
URL string `yaml:"url" json:"url"`
Headers map[string]string `yaml:"headers" json:"headers"`
Timeout time.Duration `yaml:"timeout" json:"timeout"`
Retries int `yaml:"retries" json:"retries"`
}
WebhookAuditConfig holds webhook audit configuration
type WebhookConfig ¶
type WebhookConfig struct {
Enabled bool `mapstructure:"enabled"`
Endpoints []WebhookEndpoint `mapstructure:"endpoints"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
Retries int `mapstructure:"retries" validate:"min=0,max=10"`
}
WebhookConfig contains webhook configuration
type WebhookDelivery ¶
type WebhookDelivery struct {
Enabled bool `yaml:"enabled" json:"enabled"`
URL string `yaml:"url" json:"url"`
Headers map[string]string `yaml:"headers" json:"headers"`
Timeout time.Duration `yaml:"timeout" json:"timeout"`
}
WebhookDelivery holds webhook delivery configuration
type WebhookEndpoint ¶
type WebhookEndpoint struct {
Name string `mapstructure:"name" validate:"required"`
URL string `mapstructure:"url" validate:"required,url"`
Method string `mapstructure:"method" validate:"required,oneof=GET POST PUT PATCH DELETE"`
Headers map[string]string `mapstructure:"headers"`
Events []string `mapstructure:"events"`
}
WebhookEndpoint contains webhook endpoint configuration
type WebhookPlatformConfig ¶
type WebhookPlatformConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
ContentType string `yaml:"content_type" json:"content_type"`
SSLVerify bool `yaml:"ssl_verify" json:"ssl_verify"`
Events []string `yaml:"events" json:"events"`
Settings map[string]interface{} `yaml:"settings" json:"settings"`
}
WebhookPlatformConfig holds platform-specific webhook settings
type WebhookSecurityConfig ¶
type WebhookSecurityConfig struct {
ValidateSignature bool `yaml:"validate_signature" json:"validate_signature"`
AllowedIPs []string `yaml:"allowed_ips" json:"allowed_ips"`
RateLimit int `yaml:"rate_limit" json:"rate_limit"`
}
WebhookSecurityConfig holds webhook security settings
type WorkerPoolConfig ¶
type WorkerPoolConfig struct {
MinWorkers int `yaml:"min_workers" json:"min_workers"`
MaxWorkers int `yaml:"max_workers" json:"max_workers"`
InitialWorkers int `yaml:"initial_workers" json:"initial_workers"`
TaskTimeout time.Duration `yaml:"task_timeout" json:"task_timeout"`
IdleTimeout time.Duration `yaml:"idle_timeout" json:"idle_timeout"`
HealthCheckInterval time.Duration `yaml:"health_check_interval" json:"health_check_interval"`
MaxErrorRate float64 `yaml:"max_error_rate" json:"max_error_rate"`
ScaleUpThreshold float64 `yaml:"scale_up_threshold" json:"scale_up_threshold"`
ScaleDownThreshold float64 `yaml:"scale_down_threshold" json:"scale_down_threshold"`
AutoScale bool `yaml:"auto_scale" json:"auto_scale"`
}
WorkerPoolConfig holds worker pool configuration
type ZeroDayDetectionConfig ¶
type ZeroDayDetectionConfig struct {
Enabled bool `mapstructure:"enabled"`
BehavioralAnalysis bool `mapstructure:"behavioral_analysis"`
CodeAnomalyDetection bool `mapstructure:"code_anomaly_detection"`
RuntimeAnalysis bool `mapstructure:"runtime_analysis"`
AnomalyThreshold float64 `mapstructure:"anomaly_threshold" validate:"min=0,max=1"`
Timeout time.Duration `mapstructure:"timeout" validate:"min=1s"`
}
ZeroDayDetectionConfig contains zero-day detection configuration