security

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConsentNotFound = errors.New("consent not found")
	ErrInvalidEmail    = errors.New("invalid email address")
)

Error constants

Functions

func BuildVPCNATGatewayParameterName added in v1.0.36

func BuildVPCNATGatewayParameterName(partner, stage, component string) string

BuildVPCNATGatewayParameterName builds the SSM parameter name for VPC NAT gateway lists Example: pt-partner-paytheory-prod-gochallenge-vpc-nat-gateway-list The component parameter specifies the service-specific part of the parameter name

func CheckIPAuthorization added in v1.0.36

func CheckIPAuthorization(ctx context.Context, sourceIP string, ssmClient *ssm.Client, ssmParameterName string) (bool, error)

CheckIPAuthorization is a standalone helper function for one-off IP authorization checks This is useful when you don't want to create a service instance

func ExtractClientIP added in v1.0.36

func ExtractClientIP(headers map[string]string, requestContext map[string]any) (string, error)

ExtractClientIP extracts the client's source IP address from various headers and request context. It follows the precedence order commonly used in production environments: 1. X-Forwarded-For (first IP in comma-separated list) 2. X-Real-IP 3. CF-Connecting-IP (Cloudflare) 4. X-Original-Forwarded-For 5. Request context (API Gateway specific)

Returns an error if no valid IP address can be extracted.

func IsAuthorizedIP added in v1.0.36

func IsAuthorizedIP(sourceIP string, config IPAuthorizationConfig) bool

IsAuthorizedIP checks if the given IP address is authorized based on the configuration

func IsAuthorizedIPSimple added in v1.0.36

func IsAuthorizedIPSimple(sourceIP string, allowedIPList string) bool

IsAuthorizedIPSimple checks if the source IP is in the provided allowed IP list This is a convenience function for simple use cases

func TestGDPRConsentManager_GetConsent_Fixed

func TestGDPRConsentManager_GetConsent_Fixed(t *testing.T)

func TestGDPRConsentManager_Integration_ConsentLifecycle_Fixed

func TestGDPRConsentManager_Integration_ConsentLifecycle_Fixed(t *testing.T)

Integration test

func TestGDPRConsentManager_RecordConsent_Fixed

func TestGDPRConsentManager_RecordConsent_Fixed(t *testing.T)

func TestGDPRConsentManager_Utilities_Fixed

func TestGDPRConsentManager_Utilities_Fixed(t *testing.T)

Utility tests

func TestGDPRConsentManager_WithdrawConsent_Fixed

func TestGDPRConsentManager_WithdrawConsent_Fixed(t *testing.T)

Types

type AESEncryptor

type AESEncryptor struct {
	// contains filtered or unexported fields
}

AESEncryptor handles AES encryption/decryption

func NewAESEncryptor

func NewAESEncryptor(keyString string) (*AESEncryptor, error)

NewAESEncryptor creates a new AES encryptor

func (*AESEncryptor) Decrypt

func (e *AESEncryptor) Decrypt(encryptedData string, result any) error

Decrypt decrypts data using AES

func (*AESEncryptor) Encrypt

func (e *AESEncryptor) Encrypt(data any) (string, error)

Encrypt encrypts data using AES

type APIKeyConfig

type APIKeyConfig struct {
	// Storage settings
	Provider  string `json:"provider"` // "secrets-manager", "parameter-store"
	KeyPrefix string `json:"key_prefix"`

	// Validation settings
	MinLength       int           `json:"min_length"`
	RequireRotation bool          `json:"require_rotation"`
	MaxAge          time.Duration `json:"max_age"`

	// Rate limiting for API keys
	RateLimit  int           `json:"rate_limit"`
	RatePeriod time.Duration `json:"rate_period"`
}

APIKeyConfig configures API key authentication

type AWSSecretsManager

type AWSSecretsManager struct {
	// contains filtered or unexported fields
}

AWSSecretsManager implements the SecretsProvider interface using AWS Secrets Manager

func NewAWSSecretsManager

func NewAWSSecretsManager(ctx context.Context, region, keyPrefix string) (*AWSSecretsManager, error)

NewAWSSecretsManager creates a new AWS Secrets Manager provider with plain text cache (deprecated)

func NewSecureAWSSecretsManager

func NewSecureAWSSecretsManager(ctx context.Context, region, keyPrefix string, encryptionKey []byte) (*AWSSecretsManager, error)

NewSecureAWSSecretsManager creates a new AWS Secrets Manager provider with encrypted cache

func (*AWSSecretsManager) DeleteSecret

func (asm *AWSSecretsManager) DeleteSecret(ctx context.Context, name string) error

DeleteSecret removes a secret from AWS Secrets Manager

func (*AWSSecretsManager) GetJSONSecret

func (asm *AWSSecretsManager) GetJSONSecret(ctx context.Context, name string, target any) error

GetJSONSecret retrieves and unmarshals a JSON secret

func (*AWSSecretsManager) GetSecret

func (asm *AWSSecretsManager) GetSecret(ctx context.Context, name string) (string, error)

GetSecret retrieves a secret from AWS Secrets Manager (with caching)

func (*AWSSecretsManager) PutJSONSecret

func (asm *AWSSecretsManager) PutJSONSecret(ctx context.Context, name string, value any) error

PutJSONSecret marshals and stores a JSON secret

func (*AWSSecretsManager) PutSecret

func (asm *AWSSecretsManager) PutSecret(ctx context.Context, name string, value string) error

PutSecret stores a secret in AWS Secrets Manager

func (*AWSSecretsManager) RotateSecret

func (asm *AWSSecretsManager) RotateSecret(ctx context.Context, name string) error

RotateSecret initiates rotation for a secret

type AccessControlData

type AccessControlData struct {
	UserID           string    `json:"user_id"`
	Role             string    `json:"role"`
	Permissions      []string  `json:"permissions"`
	AuthMethod       string    `json:"auth_method"`
	MFAEnabled       bool      `json:"mfa_enabled"`
	LastLogin        time.Time `json:"last_login"`
	FailedAttempts   int       `json:"failed_attempts"`
	SessionTimeout   int       `json:"session_timeout"`
	PrivilegedAccess bool      `json:"privileged_access"`
}

AccessControlData for access control monitoring

type AccessLogEntry

type AccessLogEntry struct {
	Timestamp    time.Time      `json:"timestamp"`
	UserID       string         `json:"user_id"`
	Resource     string         `json:"resource"`
	Action       string         `json:"action"`
	Result       string         `json:"result"`
	IPAddress    string         `json:"ip_address"`
	SessionID    string         `json:"session_id"`
	Duration     time.Duration  `json:"duration"`
	DataAccessed []string       `json:"data_accessed"`
	Metadata     map[string]any `json:"metadata"`
}

AccessLogEntry represents an access log entry

type AdequacyDecision

type AdequacyDecision struct {
	Country      string     `json:"country"`
	Decision     string     `json:"decision"`
	DecisionDate time.Time  `json:"decision_date"`
	ValidUntil   *time.Time `json:"valid_until,omitempty"`
	Conditions   []string   `json:"conditions"`
}

AdequacyDecision represents an adequacy decision

type AdvancedComplianceValidator

type AdvancedComplianceValidator interface {
	ComplianceValidator // Embed base interface
	ValidateSOC2Controls(ctx LiftContext, controls *SOC2Controls) (*ComplianceResult, error)
	ValidateGDPRCompliance(ctx LiftContext, operation string, data any) (*ComplianceResult, error)
	ValidateDataProcessingBasis(ctx LiftContext, basis string) (*ComplianceResult, error)
	ValidateDataMinimization(ctx LiftContext, data any) (*ComplianceResult, error)
	ValidateConsentRequirements(ctx LiftContext, consent *ConsentData) (*ComplianceResult, error)
}

AdvancedComplianceValidator provides enhanced validation

type AggregateRiskScore

type AggregateRiskScore struct {
	OverallScore     float64        `json:"overall_score"`
	Level            string         `json:"level"`
	EventCount       int            `json:"event_count"`
	TimeRange        TimeRange      `json:"time_range"`
	RiskDistribution map[string]int `json:"risk_distribution"`
	TopRiskFactors   []RiskFactor   `json:"top_risk_factors"`
	TrendDirection   string         `json:"trend_direction"`
	Recommendations  []string       `json:"recommendations"`
	Metadata         map[string]any `json:"metadata"`
}

AggregateRiskScore represents aggregated risk across multiple events

type AggregatedDataPoint

type AggregatedDataPoint struct {
	Timestamp time.Time      `json:"timestamp"`
	Value     float64        `json:"value"`
	Count     int            `json:"count"`
	Min       float64        `json:"min"`
	Max       float64        `json:"max"`
	Average   float64        `json:"average"`
	Sum       float64        `json:"sum"`
	StdDev    float64        `json:"std_dev"`
	Metadata  map[string]any `json:"metadata"`
}

AggregatedDataPoint represents an aggregated data point

type AggregatedMetrics

type AggregatedMetrics struct {
	Query       MetricsQuery   `json:"query"`
	Results     []MetricResult `json:"results"`
	Summary     MetricSummary  `json:"summary"`
	GeneratedAt time.Time      `json:"generated_at"`
	Metadata    map[string]any `json:"metadata"`
}

AggregatedMetrics represents aggregated metrics

type AlertAction

type AlertAction struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Description string         `json:"description"`
	Automated   bool           `json:"automated"`
	Parameters  map[string]any `json:"parameters"`
}

AlertAction represents an action for an alert

type AlertManager

type AlertManager interface {
	SendAlert(alert *ComplianceAlert) error
	SendCriticalAlert(alert *ComplianceAlert) error
	GetAlertHistory(since time.Time) ([]*ComplianceAlert, error)
	ConfigureAlertRules(rules []AlertRule) error
}

AlertManager interface for compliance alerting

type AlertRule

type AlertRule struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Condition   string         `json:"condition"`
	Threshold   float64        `json:"threshold"`
	Severity    string         `json:"severity"`
	Recipients  []string       `json:"recipients"`
	Channels    []string       `json:"channels"`
	Enabled     bool           `json:"enabled"`
	Metadata    map[string]any `json:"metadata"`
}

AlertRule defines alerting rules

type AlertThresholds

type AlertThresholds struct {
	CriticalRiskScore   float64 `json:"critical_risk_score"`
	HighRiskScore       float64 `json:"high_risk_score"`
	MediumRiskScore     float64 `json:"medium_risk_score"`
	AnomalyScore        float64 `json:"anomaly_score"`
	ComplianceThreshold float64 `json:"compliance_threshold"`
	TrendDeviationLimit float64 `json:"trend_deviation_limit"`
}

AlertThresholds defines thresholds for different alert types

type AnalyticsConfig

type AnalyticsConfig struct {
	Enabled               bool               `json:"enabled"`
	RealTimeAnalysis      bool               `json:"real_time_analysis"`
	PredictiveAnalysis    bool               `json:"predictive_analysis"`
	AnomalyDetection      bool               `json:"anomaly_detection"`
	AutomatedRemediation  bool               `json:"automated_remediation"`
	RiskScoringEnabled    bool               `json:"risk_scoring_enabled"`
	AnalysisInterval      time.Duration      `json:"analysis_interval"`
	DataRetentionDays     int                `json:"data_retention_days"`
	MLModelUpdateInterval time.Duration      `json:"ml_model_update_interval"`
	AlertThresholds       AlertThresholds    `json:"alert_thresholds"`
	PerformanceTargets    PerformanceTargets `json:"performance_targets"`
}

AnalyticsConfig configuration for audit analytics

type AnalyticsDataPoint

type AnalyticsDataPoint struct {
	ID        string             `json:"id"`
	Timestamp time.Time          `json:"timestamp"`
	Type      string             `json:"type"`
	Source    string             `json:"source"`
	Metrics   map[string]float64 `json:"metrics"`
	Labels    map[string]string  `json:"labels"`
	Metadata  map[string]any     `json:"metadata"`
}

AnalyticsDataPoint represents a data point for analytics

type AnalyticsDataStore

type AnalyticsDataStore interface {
	StoreAnalyticsData(ctx context.Context, data *AnalyticsDataPoint) error
	GetAnalyticsData(ctx context.Context, query *AnalyticsQuery) ([]*AnalyticsDataPoint, error)
	GetAggregatedMetrics(ctx context.Context, query *MetricsQuery) (*AggregatedMetrics, error)
	CleanupOldData(ctx context.Context, retentionPeriod time.Duration) error
}

AnalyticsDataStore interface for analytics data storage

type AnalyticsMetrics

type AnalyticsMetrics struct {
	Timestamp         time.Time           `json:"timestamp"`
	AggregatedMetrics *AggregatedMetrics  `json:"aggregated_metrics"`
	Performance       *PerformanceMetrics `json:"performance"`
}

AnalyticsMetrics represents analytics metrics

type AnalyticsQuery

type AnalyticsQuery struct {
	StartTime time.Time         `json:"start_time"`
	EndTime   time.Time         `json:"end_time"`
	Types     []string          `json:"types"`
	Sources   []string          `json:"sources"`
	Labels    map[string]string `json:"labels"`
	Limit     int               `json:"limit"`
	Offset    int               `json:"offset"`
}

AnalyticsQuery represents a query for analytics data

type Anomaly

type Anomaly struct {
	ID              string         `json:"id"`
	Type            string         `json:"type"`
	Severity        string         `json:"severity"`
	Score           float64        `json:"score"`
	Confidence      float64        `json:"confidence"`
	Description     string         `json:"description"`
	DetectedAt      time.Time      `json:"detected_at"`
	Events          []*AuditEvent  `json:"events"`
	Pattern         AnomalyPattern `json:"pattern"`
	Impact          string         `json:"impact"`
	Recommendations []string       `json:"recommendations"`
	Status          string         `json:"status"`
	Metadata        map[string]any `json:"metadata"`
}

Anomaly represents a detected anomaly

type AnomalyDetector

type AnomalyDetector interface {
	DetectAnomalies(ctx context.Context, events []*AuditEvent) ([]*Anomaly, error)
	TrainModel(ctx context.Context, trainingData []*AuditEvent) error
	UpdateBaseline(ctx context.Context, events []*AuditEvent) error
	GetAnomalyPatterns() []AnomalyPattern
}

AnomalyDetector interface for anomaly detection

type AnomalyPattern

type AnomalyPattern struct {
	ID          string             `json:"id"`
	Name        string             `json:"name"`
	Type        string             `json:"type"`
	Description string             `json:"description"`
	Indicators  []string           `json:"indicators"`
	Thresholds  map[string]float64 `json:"thresholds"`
	Enabled     bool               `json:"enabled"`
	Metadata    map[string]any     `json:"metadata"`
}

AnomalyPattern represents a pattern used for anomaly detection

type AnomalyRecord

type AnomalyRecord struct {
	Timestamp   time.Time `json:"timestamp"`
	Type        string    `json:"type"`
	Severity    string    `json:"severity"`
	Score       float64   `json:"score"`
	Resolved    bool      `json:"resolved"`
	Description string    `json:"description"`
}

AnomalyRecord represents an anomaly record

type AssessedRiskFactor

type AssessedRiskFactor struct {
	PIARiskFactor
	Score      float64 `json:"score"`
	Impact     string  `json:"impact"`
	Likelihood string  `json:"likelihood"`
	Rationale  string  `json:"rationale"`
}

AssessedRiskFactor represents an assessed risk factor

type AuditAnalyticsEngine

type AuditAnalyticsEngine struct {
	// contains filtered or unexported fields
}

AuditAnalyticsEngine provides advanced audit analytics with ML-based insights

func NewAuditAnalyticsEngine

func NewAuditAnalyticsEngine(config AnalyticsConfig) *AuditAnalyticsEngine

NewAuditAnalyticsEngine creates a new audit analytics engine

func (*AuditAnalyticsEngine) AnalyzeBatch

func (aae *AuditAnalyticsEngine) AnalyzeBatch(ctx context.Context, events []*AuditEvent) (*BatchAnalysis, error)

AnalyzeBatch analyzes a batch of audit events

func (*AuditAnalyticsEngine) AnalyzeEvent

func (aae *AuditAnalyticsEngine) AnalyzeEvent(ctx context.Context, event *AuditEvent) (*EventAnalysis, error)

AnalyzeEvent analyzes a single audit event

func (*AuditAnalyticsEngine) GeneratePredictions

func (aae *AuditAnalyticsEngine) GeneratePredictions(ctx context.Context, timeframe time.Duration) (*PredictionReport, error)

GeneratePredictions generates compliance predictions

func (*AuditAnalyticsEngine) GetAnalyticsMetrics

func (aae *AuditAnalyticsEngine) GetAnalyticsMetrics(ctx context.Context) (*AnalyticsMetrics, error)

GetAnalyticsMetrics returns current analytics metrics

func (*AuditAnalyticsEngine) SetAnomalyDetector

func (aae *AuditAnalyticsEngine) SetAnomalyDetector(detector AnomalyDetector)

SetAnomalyDetector sets the anomaly detector

func (*AuditAnalyticsEngine) SetDataStore

func (aae *AuditAnalyticsEngine) SetDataStore(store AnalyticsDataStore)

SetDataStore sets the analytics data store

func (*AuditAnalyticsEngine) SetPredictiveModel

func (aae *AuditAnalyticsEngine) SetPredictiveModel(model PredictiveModel)

SetPredictiveModel sets the predictive model

func (*AuditAnalyticsEngine) SetRemediationEngine

func (aae *AuditAnalyticsEngine) SetRemediationEngine(engine RemediationEngine)

SetRemediationEngine sets the remediation engine

func (*AuditAnalyticsEngine) SetRiskScorer

func (aae *AuditAnalyticsEngine) SetRiskScorer(scorer RiskScorer)

SetRiskScorer sets the risk scorer

func (*AuditAnalyticsEngine) Start

func (aae *AuditAnalyticsEngine) Start(ctx context.Context) error

Start starts the analytics engine

func (*AuditAnalyticsEngine) Stop

func (aae *AuditAnalyticsEngine) Stop() error

Stop stops the analytics engine

type AuditDataPoint

type AuditDataPoint struct {
	Timestamp    time.Time      `json:"timestamp"`
	EventCount   int            `json:"event_count"`
	AnomalyCount int            `json:"anomaly_count"`
	FailureRate  float64        `json:"failure_rate"`
	Metadata     map[string]any `json:"metadata"`
}

AuditDataPoint represents an audit data point

type AuditEntry

type AuditEntry struct {
	ID        string         `json:"id"`
	UserID    string         `json:"user_id"`
	TenantID  string         `json:"tenant_id"`
	Action    string         `json:"action"`
	Resource  string         `json:"resource"`
	Timestamp time.Time      `json:"timestamp"`
	Result    string         `json:"result"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

AuditEntry represents an audit trail entry

type AuditEvent

type AuditEvent struct {
	ID           string            `json:"id"`
	Timestamp    time.Time         `json:"timestamp"`
	EventType    string            `json:"event_type"`
	Source       string            `json:"source"`
	UserID       string            `json:"user_id"`
	TenantID     string            `json:"tenant_id"`
	Action       string            `json:"action"`
	Resource     string            `json:"resource"`
	Result       string            `json:"result"`
	Severity     string            `json:"severity"`
	IPAddress    string            `json:"ip_address"`
	UserAgent    string            `json:"user_agent"`
	SessionID    string            `json:"session_id"`
	RequestID    string            `json:"request_id"`
	Duration     time.Duration     `json:"duration"`
	DataAccessed []string          `json:"data_accessed"`
	Compliance   ComplianceContext `json:"compliance"`
	Security     SecurityContext   `json:"security"`
	Metadata     map[string]any    `json:"metadata"`
}

AuditEvent represents an audit event for analysis

type AuditFilter

type AuditFilter struct {
	UserID    string    `json:"user_id,omitempty"`
	TenantID  string    `json:"tenant_id,omitempty"`
	AuditID   string    `json:"audit_id,omitempty"`
	EntryType string    `json:"entry_type,omitempty"`
	Since     time.Time `json:"since,omitempty"`
	Until     time.Time `json:"until,omitempty"`
	Limit     int       `json:"limit,omitempty"`
}

AuditFilter defines filters for querying audit logs

type AuditLogEntry

type AuditLogEntry struct {
	ID            string         `json:"id"`
	AuditID       string         `json:"audit_id"`
	TenantID      string         `json:"tenant_id"`
	UserID        string         `json:"user_id"`
	EntryType     string         `json:"entry_type"` // request, response, data_access, security_event
	Timestamp     time.Time      `json:"timestamp"`
	TTL           int64          `json:"ttl"`
	Request       *AuditRequest  `json:"request,omitempty"`
	Response      *AuditResponse `json:"response,omitempty"`
	DataAccess    *DataAccessLog `json:"data_access,omitempty"`
	SecurityEvent *SecurityEvent `json:"security_event,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
	Checksum      string         `json:"checksum"`
}

AuditLogEntry represents a complete audit log entry

type AuditLogger

type AuditLogger interface {
	StartAudit(ctx LiftContext) string
	LogRequest(auditID string, request *AuditRequest) error
	LogResponse(auditID string, response *AuditResponse) error
	LogDataAccess(auditID string, access *DataAccessLog) error
	LogSecurityEvent(auditID string, event *SecurityEvent) error
}

AuditLogger handles audit trail logging

type AuditLoggerMetrics

type AuditLoggerMetrics struct {
	TotalEntries      int64         `json:"total_entries"`
	BufferedEntries   int           `json:"buffered_entries"`
	FlushCount        int64         `json:"flush_count"`
	ErrorCount        int64         `json:"error_count"`
	AverageLatency    time.Duration `json:"average_latency"`
	LastFlush         time.Time     `json:"last_flush"`
	BufferUtilization float64       `json:"buffer_utilization"`
}

AuditLoggerMetrics tracks audit system performance

type AuditMetrics

type AuditMetrics struct {
	TotalEvents         int              `json:"total_events"`
	EventsByType        map[string]int   `json:"events_by_type"`
	EventsBySeverity    map[string]int   `json:"events_by_severity"`
	EventsBySource      map[string]int   `json:"events_by_source"`
	AnomalyCount        int              `json:"anomaly_count"`
	AnomaliesByType     map[string]int   `json:"anomalies_by_type"`
	FailedEvents        int              `json:"failed_events"`
	FailureRate         float64          `json:"failure_rate"`
	AverageEventSize    float64          `json:"average_event_size"`
	EventTrend          string           `json:"event_trend"`
	DataIntegrityScore  float64          `json:"data_integrity_score"`
	LogCompleteness     float64          `json:"log_completeness"`
	RetentionCompliance float64          `json:"retention_compliance"`
	HistoricalData      []AuditDataPoint `json:"historical_data"`
}

AuditMetrics represents audit-specific metrics

type AuditQueryResult

type AuditQueryResult struct {
	Entries    []AuditLogEntry `json:"entries"`
	NextToken  string          `json:"next_token,omitempty"`
	TotalCount int             `json:"total_count"`
}

AuditQueryResult represents the result of an audit query

type AuditRequest

type AuditRequest struct {
	UserID      string            `json:"user_id"`
	TenantID    string            `json:"tenant_id"`
	Action      string            `json:"action"`
	Resource    string            `json:"resource"`
	Timestamp   time.Time         `json:"timestamp"`
	IPAddress   string            `json:"ip_address"`
	UserAgent   string            `json:"user_agent"`
	Headers     map[string]string `json:"headers,omitempty"`
	QueryParams map[string]string `json:"query_params,omitempty"`
	RequestSize int64             `json:"request_size"`
	ContentType string            `json:"content_type"`
	SessionID   string            `json:"session_id,omitempty"`
}

AuditRequest represents an auditable request

type AuditRequirement

type AuditRequirement struct {
	ID        string        `json:"id"`
	Name      string        `json:"name"`
	Type      string        `json:"type"`
	Frequency time.Duration `json:"frequency"`
	Scope     []string      `json:"scope"`
	Automated bool          `json:"automated"`
	External  bool          `json:"external"`
}

AuditRequirement defines audit requirements

type AuditResponse

type AuditResponse struct {
	StatusCode   int           `json:"status_code"`
	Duration     time.Duration `json:"duration"`
	ResponseSize int64         `json:"response_size"`
	Error        error         `json:"error,omitempty"`
	DataAccess   []string      `json:"data_access,omitempty"`
	Warnings     []string      `json:"warnings,omitempty"`
}

AuditResponse represents an auditable response

type AuditStorage

type AuditStorage interface {
	Store(ctx context.Context, entry AuditLogEntry) error
	Query(ctx context.Context, filter AuditFilter) ([]AuditLogEntry, error)
	BatchStore(ctx context.Context, entries []AuditLogEntry) error
}

AuditStorage defines the interface for audit log storage

type BCRResult

type BCRResult struct {
	Valid           bool              `json:"valid"`
	ValidationDate  time.Time         `json:"validation_date"`
	BCRApplicable   bool              `json:"bcr_applicable"`
	Issues          []ValidationIssue `json:"issues"`
	Recommendations []string          `json:"recommendations"`
	Metadata        map[string]any    `json:"metadata"`
}

BCRResult represents the result of BCR validation

type BCRValidation

type BCRValidation struct {
	CompanyGroup   string         `json:"company_group"`
	BCRVersion     string         `json:"bcr_version"`
	DataCategories []string       `json:"data_categories"`
	Purposes       []string       `json:"purposes"`
	Countries      []string       `json:"countries"`
	Metadata       map[string]any `json:"metadata"`
}

BCRValidation represents Binding Corporate Rules validation

type BankingComplianceConfig

type BankingComplianceConfig struct {
	PCIDSSLevel         string   `json:"pci_dss_level"` // "1", "2", "3", "4"
	SOXCompliance       bool     `json:"sox_compliance"`
	BSACompliance       bool     `json:"bsa_compliance"`  // Bank Secrecy Act
	GLBACompliance      bool     `json:"glba_compliance"` // Gramm-Leach-Bliley Act
	FedRAMPRequired     bool     `json:"fedramp_required"`
	RegulatedCountries  []string `json:"regulated_countries"`
	DataResidencyRules  []string `json:"data_residency_rules"`
	AMLRequired         bool     `json:"aml_required"` // Anti-Money Laundering
	KYCRequired         bool     `json:"kyc_required"` // Know Your Customer
	FraudDetectionLevel string   `json:"fraud_detection_level"`
	EncryptionStandards []string `json:"encryption_standards"`
	AuditFrequency      string   `json:"audit_frequency"`
}

BankingComplianceConfig configuration for banking compliance

type BankingComplianceTemplate

type BankingComplianceTemplate struct {
	// contains filtered or unexported fields
}

BankingComplianceTemplate for financial services compliance

func NewBankingComplianceTemplate

func NewBankingComplianceTemplate(config BankingComplianceConfig) *BankingComplianceTemplate

NewBankingComplianceTemplate creates a new banking compliance template

func (*BankingComplianceTemplate) GenerateComplianceReport

func (bct *BankingComplianceTemplate) GenerateComplianceReport() (*IndustryComplianceReport, error)

GenerateComplianceReport generates a banking compliance report

func (*BankingComplianceTemplate) GetAudits

func (bct *BankingComplianceTemplate) GetAudits() []AuditRequirement

GetAudits returns audit requirements

func (*BankingComplianceTemplate) GetComplianceMiddleware

func (bct *BankingComplianceTemplate) GetComplianceMiddleware() []LiftMiddleware

GetComplianceMiddleware returns compliance middleware

func (*BankingComplianceTemplate) GetControls

func (bct *BankingComplianceTemplate) GetControls() []ComplianceControl

GetControls returns compliance controls

func (*BankingComplianceTemplate) GetIndustry

func (bct *BankingComplianceTemplate) GetIndustry() string

GetIndustry returns the industry name

func (*BankingComplianceTemplate) GetRegulations

func (bct *BankingComplianceTemplate) GetRegulations() []string

GetRegulations returns applicable regulations

func (*BankingComplianceTemplate) GetRiskAssessments

func (bct *BankingComplianceTemplate) GetRiskAssessments() []RiskAssessmentTemplate

GetRiskAssessments returns risk assessment templates

func (*BankingComplianceTemplate) ValidateCompliance

func (bct *BankingComplianceTemplate) ValidateCompliance(ctx LiftContext) (*ComplianceResult, error)

ValidateCompliance validates compliance for banking

type BatchAnalysis

type BatchAnalysis struct {
	BatchID        string              `json:"batch_id"`
	EventCount     int                 `json:"event_count"`
	Timestamp      time.Time           `json:"timestamp"`
	EventAnalyses  []*EventAnalysis    `json:"event_analyses"`
	AggregateRisk  *AggregateRiskScore `json:"aggregate_risk,omitempty"`
	BatchAnomalies []*Anomaly          `json:"batch_anomalies,omitempty"`
}

BatchAnalysis represents the analysis of a batch of events

type BufferedAuditLogger

type BufferedAuditLogger struct {
	// contains filtered or unexported fields
}

BufferedAuditLogger implements AuditLogger with buffering for performance

func NewBufferedAuditLogger

func NewBufferedAuditLogger(storage AuditStorage, bufferSize int, flushTimeout time.Duration) *BufferedAuditLogger

NewBufferedAuditLogger creates a new buffered audit logger

func (*BufferedAuditLogger) GetAuditMetrics

func (bal *BufferedAuditLogger) GetAuditMetrics() AuditLoggerMetrics

GetAuditMetrics returns audit system metrics

func (*BufferedAuditLogger) LogDataAccess

func (bal *BufferedAuditLogger) LogDataAccess(auditID string, access *DataAccessLog) error

LogDataAccess logs data access for audit trails

func (*BufferedAuditLogger) LogRequest

func (bal *BufferedAuditLogger) LogRequest(auditID string, request *AuditRequest) error

LogRequest logs an audit request

func (*BufferedAuditLogger) LogResponse

func (bal *BufferedAuditLogger) LogResponse(auditID string, response *AuditResponse) error

LogResponse logs an audit response

func (*BufferedAuditLogger) LogSecurityEvent

func (bal *BufferedAuditLogger) LogSecurityEvent(auditID string, event *SecurityEvent) error

LogSecurityEvent logs a security event

func (*BufferedAuditLogger) QueryAuditTrail

func (bal *BufferedAuditLogger) QueryAuditTrail(ctx context.Context, filter AuditFilter) (*AuditQueryResult, error)

QueryAuditTrail queries the audit trail

func (*BufferedAuditLogger) StartAudit

func (bal *BufferedAuditLogger) StartAudit(ctx LiftContext) string

StartAudit starts a new audit session and returns an audit ID

func (*BufferedAuditLogger) Stop

func (bal *BufferedAuditLogger) Stop() error

Stop stops the audit logger and flushes remaining entries

func (*BufferedAuditLogger) VerifyIntegrity

func (bal *BufferedAuditLogger) VerifyIntegrity(ctx context.Context, auditID string) (bool, error)

VerifyIntegrity verifies the integrity of audit entries

type BusinessContinuityData

type BusinessContinuityData struct {
	PlanID            string        `json:"plan_id"`
	LastTested        time.Time     `json:"last_tested"`
	TestResults       string        `json:"test_results"`
	RPO               time.Duration `json:"rpo"` // Recovery Point Objective
	RTO               time.Duration `json:"rto"` // Recovery Time Objective
	BackupStrategy    string        `json:"backup_strategy"`
	DisasterRecovery  bool          `json:"disaster_recovery"`
	CommunicationPlan bool          `json:"communication_plan"`
}

BusinessContinuityData for business continuity controls

type CORSConfig

type CORSConfig struct {
	AllowedOrigins   []string `json:"allowed_origins"`
	AllowedMethods   []string `json:"allowed_methods"`
	AllowedHeaders   []string `json:"allowed_headers"`
	ExposedHeaders   []string `json:"exposed_headers"`
	AllowCredentials bool     `json:"allow_credentials"`
	MaxAge           int      `json:"max_age"`

	// Dynamic origin validation
	ValidateOrigin func(origin string) bool `json:"-"`
}

CORSConfig defines Cross-Origin Resource Sharing settings

type CachedSecret

type CachedSecret struct {
	Value     string
	ExpiresAt time.Time
}

CachedSecret represents a cached secret with expiration

type CertificationStatus

type CertificationStatus struct {
	Certification  string    `json:"certification"`
	Status         string    `json:"status"`
	ValidFrom      time.Time `json:"valid_from"`
	ValidUntil     time.Time `json:"valid_until"`
	CertifyingBody string    `json:"certifying_body"`
	Scope          []string  `json:"scope"`
	Conditions     []string  `json:"conditions"`
	NextReview     time.Time `json:"next_review"`
}

CertificationStatus represents certification status

type ChangeManagementData

type ChangeManagementData struct {
	ChangeID             string    `json:"change_id"`
	ChangeType           string    `json:"change_type"`
	Requestor            string    `json:"requestor"`
	Approver             string    `json:"approver"`
	ApprovalDate         time.Time `json:"approval_date"`
	ImplementationDate   time.Time `json:"implementation_date"`
	TestingCompleted     bool      `json:"testing_completed"`
	RollbackPlan         bool      `json:"rollback_plan"`
	DocumentationUpdated bool      `json:"documentation_updated"`
}

ChangeManagementData for change management controls

type ComplianceAlert

type ComplianceAlert struct {
	ID             string         `json:"id"`
	Type           string         `json:"type"`
	Severity       string         `json:"severity"`
	Title          string         `json:"title"`
	Description    string         `json:"description"`
	ControlID      string         `json:"control_id"`
	Timestamp      time.Time      `json:"timestamp"`
	Recipients     []string       `json:"recipients"`
	Channels       []string       `json:"channels"`
	Escalated      bool           `json:"escalated"`
	Acknowledged   bool           `json:"acknowledged"`
	AcknowledgedBy string         `json:"acknowledged_by"`
	AcknowledgedAt *time.Time     `json:"acknowledged_at,omitempty"`
	Resolved       bool           `json:"resolved"`
	ResolvedAt     *time.Time     `json:"resolved_at,omitempty"`
	Metadata       map[string]any `json:"metadata"`
}

ComplianceAlert represents a compliance alert

type ComplianceConfig

type ComplianceConfig struct {
	EnabledFrameworks  []string          `json:"enabled_frameworks"`
	AuditRetention     time.Duration     `json:"audit_retention"`
	DataClassification map[string]string `json:"data_classification"`
	EncryptionRequired bool              `json:"encryption_required"`
	RegionRestrictions []string          `json:"region_restrictions"`
	CustomRules        []ComplianceRule  `json:"custom_rules"`
}

ComplianceConfig holds configuration for compliance frameworks

type ComplianceContext

type ComplianceContext struct {
	Framework    string   `json:"framework"`
	Controls     []string `json:"controls"`
	Requirements []string `json:"requirements"`
	Violations   []string `json:"violations"`
	RiskLevel    string   `json:"risk_level"`
	DataCategory string   `json:"data_category"`
}

ComplianceContext provides compliance-specific context

type ComplianceControl

type ComplianceControl struct {
	ID          string                `json:"id"`
	Name        string                `json:"name"`
	Description string                `json:"description"`
	Framework   string                `json:"framework"`
	Category    string                `json:"category"`
	Severity    string                `json:"severity"`
	Automated   bool                  `json:"automated"`
	Frequency   time.Duration         `json:"frequency"`
	Evidence    []EvidenceRequirement `json:"evidence"`
	Tests       []ComplianceTest      `json:"tests"`
	Remediation string                `json:"remediation"`
	Metadata    map[string]any        `json:"metadata"`
}

ComplianceControl defines a specific control

type ComplianceDashboard

type ComplianceDashboard struct {
	// contains filtered or unexported fields
}

ComplianceDashboard provides real-time compliance visibility

func NewComplianceDashboard

func NewComplianceDashboard(config DashboardConfig) *ComplianceDashboard

NewComplianceDashboard creates a new compliance dashboard

func (*ComplianceDashboard) CreateDashboardLayout

func (cd *ComplianceDashboard) CreateDashboardLayout(ctx context.Context, layout *DashboardLayout) error

CreateDashboardLayout creates a new dashboard layout

func (*ComplianceDashboard) DeleteDashboardLayout

func (cd *ComplianceDashboard) DeleteDashboardLayout(ctx context.Context, layoutID string) error

DeleteDashboardLayout deletes a dashboard layout

func (*ComplianceDashboard) ExportDashboardData

func (cd *ComplianceDashboard) ExportDashboardData(ctx context.Context, format string, timeRange TimeRange) ([]byte, error)

ExportDashboardData exports dashboard data

func (*ComplianceDashboard) GetDashboardLayout

func (cd *ComplianceDashboard) GetDashboardLayout(ctx context.Context, layoutID string) (*DashboardLayout, error)

GetDashboardLayout returns a dashboard layout

func (*ComplianceDashboard) GetDashboardMetrics

func (cd *ComplianceDashboard) GetDashboardMetrics(ctx context.Context, timeRange TimeRange) (*DashboardMetrics, error)

GetDashboardMetrics returns current dashboard metrics

func (*ComplianceDashboard) GetWidget

func (cd *ComplianceDashboard) GetWidget(ctx context.Context, widgetID string, config WidgetConfig) (*DashboardWidget, error)

GetWidget returns a specific widget's data

func (*ComplianceDashboard) SetAlertManager

func (cd *ComplianceDashboard) SetAlertManager(manager DashboardAlertManager)

SetAlertManager sets the alert manager

func (*ComplianceDashboard) SetCache

func (cd *ComplianceDashboard) SetCache(cache DashboardCache)

SetCache sets the dashboard cache

func (*ComplianceDashboard) SetDataAggregator

func (cd *ComplianceDashboard) SetDataAggregator(aggregator DataAggregator)

SetDataAggregator sets the data aggregator

func (*ComplianceDashboard) SetMetricsEngine

func (cd *ComplianceDashboard) SetMetricsEngine(engine MetricsEngine)

SetMetricsEngine sets the metrics engine

func (*ComplianceDashboard) Start

func (cd *ComplianceDashboard) Start(ctx context.Context) error

Start starts the dashboard

func (*ComplianceDashboard) Stop

func (cd *ComplianceDashboard) Stop() error

Stop stops the dashboard

func (*ComplianceDashboard) UpdateDashboardLayout

func (cd *ComplianceDashboard) UpdateDashboardLayout(ctx context.Context, layoutID string, layout *DashboardLayout) error

UpdateDashboardLayout updates a dashboard layout

type ComplianceDataPoint

type ComplianceDataPoint struct {
	Timestamp       time.Time      `json:"timestamp"`
	ComplianceScore float64        `json:"compliance_score"`
	ViolationCount  int            `json:"violation_count"`
	ControlCount    int            `json:"control_count"`
	Framework       string         `json:"framework"`
	Metadata        map[string]any `json:"metadata"`
}

ComplianceDataPoint represents a compliance data point

type ComplianceException

type ComplianceException struct {
	ID                 string               `json:"id"`
	ControlID          string               `json:"control_id"`
	ExceptionType      string               `json:"exception_type"`
	Severity           string               `json:"severity"`
	Description        string               `json:"description"`
	DetectedDate       time.Time            `json:"detected_date"`
	ReportedBy         string               `json:"reported_by"`
	Status             string               `json:"status"` // "open", "in_progress", "resolved", "accepted"
	AssignedTo         string               `json:"assigned_to"`
	DueDate            time.Time            `json:"due_date"`
	Resolution         *ExceptionResolution `json:"resolution,omitempty"`
	Impact             string               `json:"impact"`
	RootCause          string               `json:"root_cause"`
	Remediation        string               `json:"remediation"`
	PreventiveMeasures []string             `json:"preventive_measures"`
	Metadata           map[string]any       `json:"metadata"`
}

ComplianceException represents a compliance exception

type ComplianceFinding

type ComplianceFinding struct {
	ID          string    `json:"id"`
	Type        string    `json:"type"` // "violation", "weakness", "observation"
	Severity    string    `json:"severity"`
	Description string    `json:"description"`
	Evidence    string    `json:"evidence"`
	Impact      string    `json:"impact"`
	Remediation string    `json:"remediation"`
	Status      string    `json:"status"`
	AssignedTo  string    `json:"assigned_to"`
	DueDate     time.Time `json:"due_date"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

ComplianceFinding represents a compliance finding

type ComplianceFramework

type ComplianceFramework struct {
	// contains filtered or unexported fields
}

ComplianceFramework defines the compliance requirements and enforcement

func NewComplianceFramework

func NewComplianceFramework(framework string, config ComplianceConfig) *ComplianceFramework

NewComplianceFramework creates a new compliance framework

func (*ComplianceFramework) AddCustomRule

func (cf *ComplianceFramework) AddCustomRule(rule ComplianceRule)

AddCustomRule adds a custom compliance rule

func (*ComplianceFramework) ComplianceAudit

func (cf *ComplianceFramework) ComplianceAudit() LiftMiddleware

ComplianceAudit creates middleware for compliance auditing

func (*ComplianceFramework) GenerateComplianceReport

func (cf *ComplianceFramework) GenerateComplianceReport(period time.Duration) (*ComplianceReport, error)

GenerateComplianceReport generates a compliance report

func (*ComplianceFramework) GetComplianceStatus

func (cf *ComplianceFramework) GetComplianceStatus(ctx context.Context) (*ComplianceResult, error)

GetComplianceStatus returns the current compliance status

func (*ComplianceFramework) GetCustomRules

func (cf *ComplianceFramework) GetCustomRules() []ComplianceRule

GetCustomRules returns all custom compliance rules

func (*ComplianceFramework) IsFrameworkEnabled

func (cf *ComplianceFramework) IsFrameworkEnabled(framework string) bool

IsFrameworkEnabled checks if a compliance framework is enabled

func (*ComplianceFramework) MarshalJSON

func (cf *ComplianceFramework) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for ComplianceFramework

func (*ComplianceFramework) SetAuditor

func (cf *ComplianceFramework) SetAuditor(auditor AuditLogger)

SetAuditor sets the audit logger

func (*ComplianceFramework) SetReporter

func (cf *ComplianceFramework) SetReporter(reporter ComplianceReporter)

SetReporter sets the compliance reporter

func (*ComplianceFramework) SetValidator

func (cf *ComplianceFramework) SetValidator(validator ComplianceValidator)

SetValidator sets the compliance validator

func (*ComplianceFramework) ValidateConfiguration

func (cf *ComplianceFramework) ValidateConfiguration() error

ValidateConfiguration validates the compliance configuration

type ComplianceIssue

type ComplianceIssue struct {
	ID          string         `json:"id"`
	Type        string         `json:"type"`
	Severity    string         `json:"severity"`
	Description string         `json:"description"`
	Framework   string         `json:"framework"`
	Controls    []string       `json:"controls"`
	Evidence    []string       `json:"evidence"`
	Impact      string         `json:"impact"`
	RiskScore   float64        `json:"risk_score"`
	DetectedAt  time.Time      `json:"detected_at"`
	Deadline    time.Time      `json:"deadline"`
	Metadata    map[string]any `json:"metadata"`
}

ComplianceIssue represents a compliance issue requiring remediation

type ComplianceMetrics

type ComplianceMetrics struct {
	OverallScore         float64                    `json:"overall_score"`
	FrameworkScores      map[string]float64         `json:"framework_scores"`
	ControlEffectiveness map[string]float64         `json:"control_effectiveness"`
	ViolationCount       int                        `json:"violation_count"`
	ViolationsByType     map[string]int             `json:"violations_by_type"`
	ViolationsBySeverity map[string]int             `json:"violations_by_severity"`
	ComplianceRate       float64                    `json:"compliance_rate"`
	TrendDirection       string                     `json:"trend_direction"`
	LastAuditDate        time.Time                  `json:"last_audit_date"`
	NextAuditDate        time.Time                  `json:"next_audit_date"`
	CertificationStatus  []CertificationStatus      `json:"certification_status"`
	Recommendations      []ComplianceRecommendation `json:"recommendations"`
	HistoricalData       []ComplianceDataPoint      `json:"historical_data"`
}

ComplianceMetrics represents compliance-specific metrics

type CompliancePrediction

type CompliancePrediction struct {
	Timeframe       time.Duration          `json:"timeframe"`
	PredictedRisk   float64                `json:"predicted_risk"`
	Confidence      float64                `json:"confidence"`
	RiskFactors     []PredictiveRiskFactor `json:"risk_factors"`
	Scenarios       []RiskScenario         `json:"scenarios"`
	Recommendations []string               `json:"recommendations"`
	GeneratedAt     time.Time              `json:"generated_at"`
	Metadata        map[string]any         `json:"metadata"`
}

CompliancePrediction represents a compliance risk prediction

type ComplianceRecommendation

type ComplianceRecommendation struct {
	ID          string    `json:"id"`
	Priority    string    `json:"priority"`
	Category    string    `json:"category"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Actions     []string  `json:"actions"`
	Timeline    string    `json:"timeline"`
	Cost        string    `json:"cost"`
	Impact      string    `json:"impact"`
	Owner       string    `json:"owner"`
	DueDate     time.Time `json:"due_date"`
	Status      string    `json:"status"`
}

ComplianceRecommendation represents a compliance recommendation

type ComplianceReport

type ComplianceReport struct {
	Framework     string                `json:"framework"`
	Period        time.Duration         `json:"period"`
	GeneratedAt   time.Time             `json:"generated_at"`
	TotalRequests int64                 `json:"total_requests"`
	Violations    []ComplianceViolation `json:"violations"`
	Summary       ComplianceSummary     `json:"summary"`
}

ComplianceReport represents a compliance report

type ComplianceReporter

type ComplianceReporter interface {
	GenerateReport(framework string, period time.Duration) (*ComplianceReport, error)
	GetViolations(framework string, since time.Time) ([]ComplianceViolation, error)
	GetAuditTrail(userID, tenantID string, since time.Time) ([]AuditEntry, error)
}

ComplianceReporter generates compliance reports

type ComplianceResult

type ComplianceResult struct {
	Compliant  bool                  `json:"compliant"`
	Framework  string                `json:"framework"`
	Violations []ComplianceViolation `json:"violations,omitempty"`
	Warnings   []string              `json:"warnings,omitempty"`
	Metadata   map[string]any        `json:"metadata,omitempty"`
	Timestamp  time.Time             `json:"timestamp"`
}

ComplianceResult represents the result of compliance validation

type ComplianceRule

type ComplianceRule struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Framework   string         `json:"framework"`
	Severity    string         `json:"severity"`
	Description string         `json:"description"`
	Condition   map[string]any `json:"condition"`
	Action      string         `json:"action"`
}

ComplianceRule defines a custom compliance rule

type ComplianceSummary

type ComplianceSummary struct {
	ComplianceRate   float64           `json:"compliance_rate"`
	ViolationsByType map[string]int    `json:"violations_by_type"`
	TopViolations    []string          `json:"top_violations"`
	TrendData        []ComplianceTrend `json:"trend_data"`
	Recommendations  []string          `json:"recommendations"`
}

ComplianceSummary provides a summary of compliance status

type ComplianceTemplate

type ComplianceTemplate interface {
	GetIndustry() string
	GetRegulations() []string
	GetControls() []ComplianceControl
	GetAudits() []AuditRequirement
	ApplyToFramework(framework *EnhancedComplianceFramework) error
}

ComplianceTemplate interface for industry templates

type ComplianceTest

type ComplianceTest struct {
	ID         string             `json:"id"`
	Name       string             `json:"name"`
	Type       string             `json:"type"` // "technical", "administrative", "physical"
	Automated  bool               `json:"automated"`
	Frequency  time.Duration      `json:"frequency"`
	Parameters map[string]any     `json:"parameters"`
	Thresholds map[string]float64 `json:"thresholds"`
}

ComplianceTest defines automated compliance tests

type ComplianceTestResult

type ComplianceTestResult struct {
	TestID          string              `json:"test_id"`
	TestName        string              `json:"test_name"`
	Framework       string              `json:"framework"`
	ControlID       string              `json:"control_id"`
	TestType        string              `json:"test_type"`
	ExecutionTime   time.Time           `json:"execution_time"`
	Duration        time.Duration       `json:"duration"`
	Status          string              `json:"status"` // "pass", "fail", "warning", "error"
	Score           float64             `json:"score"`
	Threshold       float64             `json:"threshold"`
	Evidence        []Evidence          `json:"evidence"`
	Findings        []ComplianceFinding `json:"findings"`
	Recommendations []string            `json:"recommendations"`
	Metadata        map[string]any      `json:"metadata"`
}

ComplianceTestResult for automated compliance testing

type ComplianceTrend

type ComplianceTrend struct {
	Date           time.Time `json:"date"`
	ComplianceRate float64   `json:"compliance_rate"`
	ViolationCount int       `json:"violation_count"`
}

ComplianceTrend represents compliance trend data

type ComplianceValidator

type ComplianceValidator interface {
	ValidateRequest(ctx LiftContext, framework string) (*ComplianceResult, error)
	ValidateDataAccess(ctx LiftContext, dataType string) (*ComplianceResult, error)
	ValidateRegion(ctx LiftContext, region string) (*ComplianceResult, error)
}

ComplianceValidator validates requests against compliance rules

type ComplianceViolation

type ComplianceViolation struct {
	ID          string         `json:"id"`
	RuleID      string         `json:"rule_id"`
	Framework   string         `json:"framework"`
	Severity    string         `json:"severity"`
	Description string         `json:"description"`
	UserID      string         `json:"user_id,omitempty"`
	TenantID    string         `json:"tenant_id,omitempty"`
	Resource    string         `json:"resource,omitempty"`
	Timestamp   time.Time      `json:"timestamp"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	Resolved    bool           `json:"resolved"`
}

ComplianceViolation represents a compliance violation

type ConsentData

type ConsentData struct {
	ConsentID        string     `json:"consent_id"`
	DataSubject      string     `json:"data_subject"`
	ConsentGiven     bool       `json:"consent_given"`
	ConsentDate      time.Time  `json:"consent_date"`
	ConsentMethod    string     `json:"consent_method"`
	ConsentScope     []string   `json:"consent_scope"`
	ConsentVersion   string     `json:"consent_version"`
	WithdrawalDate   *time.Time `json:"withdrawal_date,omitempty"`
	WithdrawalMethod string     `json:"withdrawal_method,omitempty"`
	ExpiryDate       *time.Time `json:"expiry_date,omitempty"`
	Granular         bool       `json:"granular"`
	Specific         bool       `json:"specific"`
	Informed         bool       `json:"informed"`
	Unambiguous      bool       `json:"unambiguous"`
}

ConsentData for GDPR consent management

type ConsentEvent

type ConsentEvent struct {
	EventType     string         `json:"event_type"`
	ConsentID     string         `json:"consent_id"`
	DataSubjectID string         `json:"data_subject_id"`
	Timestamp     time.Time      `json:"timestamp"`
	Details       map[string]any `json:"details"`
	IPAddress     string         `json:"ip_address"`
	UserAgent     string         `json:"user_agent"`
	Metadata      map[string]any `json:"metadata"`
}

ConsentEvent represents a consent-related event for audit logging

type ConsentHistoryEntry

type ConsentHistoryEntry struct {
	ID            string         `json:"id"`
	ConsentID     string         `json:"consent_id"`
	Action        string         `json:"action"` // "created", "updated", "withdrawn", "renewed"
	Timestamp     time.Time      `json:"timestamp"`
	DataSubjectID string         `json:"data_subject_id"`
	Changes       map[string]any `json:"changes"`
	UpdatedBy     string         `json:"updated_by"`
	Reason        string         `json:"reason"`
	IPAddress     string         `json:"ip_address"`
	UserAgent     string         `json:"user_agent"`
	Metadata      map[string]any `json:"metadata"`
}

ConsentHistoryEntry represents a historical consent entry

type ConsentProof

type ConsentProof struct {
	Type      string         `json:"type"` // "digital_signature", "double_opt_in", "recorded_consent"
	Evidence  string         `json:"evidence"`
	Timestamp time.Time      `json:"timestamp"`
	IPAddress string         `json:"ip_address"`
	UserAgent string         `json:"user_agent"`
	Method    string         `json:"method"`
	Verified  bool           `json:"verified"`
	Signature string         `json:"signature,omitempty"`
	Metadata  map[string]any `json:"metadata"`
}

ConsentProof represents proof of consent

type ConsentPurpose

type ConsentPurpose struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Required    bool      `json:"required"`
	Consented   bool      `json:"consented"`
	ConsentDate time.Time `json:"consent_date"`
	LegalBasis  string    `json:"legal_basis"`
}

ConsentPurpose represents a specific purpose for data processing

type ConsentRecord

type ConsentRecord struct {
	ID                 string           `json:"id"`
	DataSubjectID      string           `json:"data_subject_id"`
	DataSubjectEmail   string           `json:"data_subject_email"`
	ConsentVersion     string           `json:"consent_version"`
	ConsentDate        time.Time        `json:"consent_date"`
	ConsentMethod      string           `json:"consent_method"` // "explicit", "implicit", "opt_in", "opt_out"
	ConsentScope       []ConsentPurpose `json:"consent_scope"`
	LegalBasis         string           `json:"legal_basis"`
	ProcessingPurposes []string         `json:"processing_purposes"`
	DataCategories     []string         `json:"data_categories"`
	Recipients         []DataRecipient  `json:"recipients"`
	RetentionPeriod    time.Duration    `json:"retention_period"`
	ExpiryDate         *time.Time       `json:"expiry_date,omitempty"`
	RenewalDate        *time.Time       `json:"renewal_date,omitempty"`
	WithdrawalDate     *time.Time       `json:"withdrawal_date,omitempty"`
	WithdrawalMethod   string           `json:"withdrawal_method,omitempty"`
	ConsentProof       *ConsentProof    `json:"consent_proof,omitempty"`
	Status             string           `json:"status"` // "active", "expired", "withdrawn", "renewed"
	Granular           bool             `json:"granular"`
	Specific           bool             `json:"specific"`
	Informed           bool             `json:"informed"`
	Unambiguous        bool             `json:"unambiguous"`
	// Additional fields needed by tests
	Purpose      string         `json:"purpose,omitempty"`
	ConsentGiven bool           `json:"consent_given"`
	Timestamp    *time.Time     `json:"timestamp,omitempty"`
	Source       string         `json:"source,omitempty"`
	IPAddress    string         `json:"ip_address,omitempty"`
	UserAgent    string         `json:"user_agent,omitempty"`
	Metadata     map[string]any `json:"metadata"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
}

ConsentRecord represents a complete consent record

type ConsentStore

type ConsentStore interface {
	StoreConsent(ctx context.Context, consent *ConsentRecord) error
	GetConsent(ctx context.Context, dataSubjectID, purpose string) (*ConsentRecord, error)
	GetAllConsents(ctx context.Context, dataSubjectID string) ([]*ConsentRecord, error)
	UpdateConsent(ctx context.Context, consentID string, updates *ConsentUpdates) error
	WithdrawConsent(ctx context.Context, consentID string, withdrawal *ConsentWithdrawal) error
	GetExpiredConsents(ctx context.Context) ([]*ConsentRecord, error)
	GetConsentsForRenewal(ctx context.Context) ([]*ConsentRecord, error)
	// Additional methods needed by tests
	RecordConsent(ctx context.Context, consent *ConsentRecord) error
	ListConsents(ctx context.Context, dataSubjectID string) ([]*ConsentRecord, error)
	GetConsentHistory(ctx context.Context, consentID string) ([]*ConsentHistoryEntry, error)
	CleanupExpiredConsents(ctx context.Context) error
}

ConsentStore interface for storing and retrieving consent data

type ConsentUpdate

type ConsentUpdate = ConsentUpdates

ConsentUpdate represents updates to consent (alias for ConsentUpdates for test compatibility)

type ConsentUpdates

type ConsentUpdates struct {
	ConsentScope    []ConsentPurpose `json:"consent_scope,omitempty"`
	Recipients      []DataRecipient  `json:"recipients,omitempty"`
	RetentionPeriod *time.Duration   `json:"retention_period,omitempty"`
	ExpiryDate      *time.Time       `json:"expiry_date,omitempty"`
	UpdatedBy       string           `json:"updated_by"`
	UpdateReason    string           `json:"update_reason"`
	// Additional fields needed by tests
	ConsentGiven bool           `json:"consent_given,omitempty"`
	Timestamp    time.Time      `json:"timestamp,omitempty"`
	Reason       string         `json:"reason,omitempty"`
	Metadata     map[string]any `json:"metadata,omitempty"`
}

ConsentUpdates represents updates to consent

type ConsentWithdrawal

type ConsentWithdrawal struct {
	WithdrawalDate    time.Time `json:"withdrawal_date"`
	WithdrawalMethod  string    `json:"withdrawal_method"`
	Reason            string    `json:"reason,omitempty"`
	PartialWithdrawal bool      `json:"partial_withdrawal"`
	WithdrawnPurposes []string  `json:"withdrawn_purposes,omitempty"`
	RequestedBy       string    `json:"requested_by"`
	Verified          bool      `json:"verified"`
	// Additional fields needed by tests
	Timestamp time.Time      `json:"timestamp,omitempty"`
	Method    string         `json:"method,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

ConsentWithdrawal represents consent withdrawal

type ContextualRiskFactor

type ContextualRiskFactor struct {
	RiskFactor
	Context    string         `json:"context"`
	Conditions map[string]any `json:"conditions"`
	Multiplier float64        `json:"multiplier"`
	Temporal   bool           `json:"temporal"`
	Behavioral bool           `json:"behavioral"`
}

ContextualRiskFactor represents a contextual risk factor

type ControlEvidence

type ControlEvidence struct {
	ID               string         `json:"id"`
	ControlID        string         `json:"control_id"`
	EvidenceType     string         `json:"evidence_type"`
	Description      string         `json:"description"`
	Source           string         `json:"source"`
	CollectionDate   time.Time      `json:"collection_date"`
	Data             map[string]any `json:"data"`
	Verified         bool           `json:"verified"`
	VerificationDate *time.Time     `json:"verification_date,omitempty"`
	VerifiedBy       string         `json:"verified_by"`
	Integrity        string         `json:"integrity"` // checksum/hash
	RetentionDate    time.Time      `json:"retention_date"`
	Archived         bool           `json:"archived"`
	Metadata         map[string]any `json:"metadata"`
}

ControlEvidence represents evidence collected for a control

type ControlStatus

type ControlStatus struct {
	ControlID           string         `json:"control_id"`
	CurrentStatus       string         `json:"current_status"`
	LastTestDate        time.Time      `json:"last_test_date"`
	NextTestDate        time.Time      `json:"next_test_date"`
	ComplianceRate      float64        `json:"compliance_rate"`
	ExceptionCount      int            `json:"exception_count"`
	TrendDirection      string         `json:"trend_direction"` // "improving", "stable", "declining"
	RiskLevel           string         `json:"risk_level"`
	EffectivenessRating float64        `json:"effectiveness_rating"`
	Metadata            map[string]any `json:"metadata"`
}

ControlStatus represents the current status of a control

type ControlTestResult

type ControlTestResult struct {
	ControlID       string                 `json:"control_id"`
	TestID          string                 `json:"test_id"`
	TestDate        time.Time              `json:"test_date"`
	TestType        string                 `json:"test_type"`
	Status          string                 `json:"status"` // "effective", "ineffective", "not_tested"
	Score           float64                `json:"score"`
	Threshold       float64                `json:"threshold"`
	Passed          bool                   `json:"passed"`
	Evidence        []*ControlEvidence     `json:"evidence"`
	Exceptions      []*ComplianceException `json:"exceptions"`
	Findings        []string               `json:"findings"`
	Recommendations []string               `json:"recommendations"`
	TestDuration    time.Duration          `json:"test_duration"`
	TesterID        string                 `json:"tester_id"`
	ReviewerID      string                 `json:"reviewer_id"`
	Metadata        map[string]any         `json:"metadata"`
}

ControlTestResult represents the result of a control test

type ControlTester

type ControlTester interface {
	TestControl(ctx context.Context, control SOC2Control) (*ControlTestResult, error)
	TestAllControls(ctx context.Context) ([]*ControlTestResult, error)
	GetControlStatus(controlID string) (*ControlStatus, error)
	ScheduleControlTest(controlID string, frequency time.Duration) error
}

ControlTester interface for automated control testing

type CrossBorderRule

type CrossBorderRule struct {
	ID                 string   `json:"id"`
	Name               string   `json:"name"`
	SourceCountries    []string `json:"source_countries"`
	DestCountries      []string `json:"dest_countries"`
	DataCategories     []string `json:"data_categories"`
	RequiredSafeguards []string `json:"required_safeguards"`
	Prohibited         bool     `json:"prohibited"`
	Conditions         []string `json:"conditions"`
}

CrossBorderRule represents a rule for cross-border transfers

type CrossBorderTransfer

type CrossBorderTransfer struct {
	ID                 string         `json:"id"`
	DataExporter       string         `json:"data_exporter"`
	DataImporter       string         `json:"data_importer"`
	SourceCountry      string         `json:"source_country"`
	DestinationCountry string         `json:"destination_country"`
	DataCategories     []string       `json:"data_categories"`
	Purposes           []string       `json:"purposes"`
	LegalBasis         string         `json:"legal_basis"`
	Safeguards         []string       `json:"safeguards"`
	AdequacyDecision   bool           `json:"adequacy_decision"`
	SCCApplied         bool           `json:"scc_applied"`
	BCRApplied         bool           `json:"bcr_applied"`
	TransferDate       time.Time      `json:"transfer_date"`
	Volume             string         `json:"volume"`
	Frequency          string         `json:"frequency"`
	Metadata           map[string]any `json:"metadata"`
}

CrossBorderTransfer represents a cross-border data transfer

type CrossBorderTransferLog

type CrossBorderTransferLog struct {
	TransferID         string         `json:"transfer_id"`
	DataExporter       string         `json:"data_exporter"`
	DataImporter       string         `json:"data_importer"`
	SourceCountry      string         `json:"source_country"`
	DestinationCountry string         `json:"destination_country"`
	Timestamp          time.Time      `json:"timestamp"`
	LegalBasis         string         `json:"legal_basis"`
	Safeguards         []string       `json:"safeguards"`
	Metadata           map[string]any `json:"metadata"`
}

CrossBorderTransferLog represents a cross-border transfer for audit logging

type CrossBorderValidator

type CrossBorderValidator interface {
	ValidateTransfer(ctx context.Context, transfer *CrossBorderTransfer) (*TransferValidation, error)
	GetAdequacyDecisions() ([]AdequacyDecision, error)
	ValidateStandardContractualClauses(ctx context.Context, clauses *SCCValidation) (*SCCResult, error)
	ValidateBindingCorporateRules(ctx context.Context, bcr *BCRValidation) (*BCRResult, error)
}

CrossBorderValidator interface for cross-border data transfer validation

type CustomMetric

type CustomMetric struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Value       float64        `json:"value"`
	Unit        string         `json:"unit"`
	Type        string         `json:"type"`
	Category    string         `json:"category"`
	Timestamp   time.Time      `json:"timestamp"`
	Metadata    map[string]any `json:"metadata"`
}

CustomMetric represents a custom metric

type CustomMetricQuery

type CustomMetricQuery struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Query       string         `json:"query"`
	Type        string         `json:"type"`
	Parameters  map[string]any `json:"parameters"`
	Aggregation string         `json:"aggregation"`
	TimeRange   TimeRange      `json:"time_range"`
}

CustomMetricQuery represents a query for custom metrics

type DashboardAlert

type DashboardAlert struct {
	ID             string         `json:"id"`
	Type           string         `json:"type"`
	Severity       string         `json:"severity"`
	Title          string         `json:"title"`
	Description    string         `json:"description"`
	Metric         string         `json:"metric"`
	Threshold      float64        `json:"threshold"`
	CurrentValue   float64        `json:"current_value"`
	Timestamp      time.Time      `json:"timestamp"`
	Status         string         `json:"status"`
	AcknowledgedBy string         `json:"acknowledged_by,omitempty"`
	AcknowledgedAt *time.Time     `json:"acknowledged_at,omitempty"`
	ResolvedAt     *time.Time     `json:"resolved_at,omitempty"`
	Actions        []AlertAction  `json:"actions"`
	Metadata       map[string]any `json:"metadata"`
}

DashboardAlert represents a dashboard alert

type DashboardAlertManager

type DashboardAlertManager interface {
	CheckThresholds(ctx context.Context, metrics *DashboardMetrics) ([]*DashboardAlert, error)
	SendAlert(ctx context.Context, alert *DashboardAlert) error
	GetActiveAlerts(ctx context.Context) ([]*DashboardAlert, error)
	AcknowledgeAlert(ctx context.Context, alertID string, acknowledgedBy string) error
}

DashboardAlertManager interface for dashboard alerts

type DashboardCache

type DashboardCache interface {
	Get(key string) (any, bool)
	Set(key string, value any, ttl time.Duration)
	Delete(key string)
	Clear()
}

DashboardCache interface for dashboard caching

type DashboardConfig

type DashboardConfig struct {
	Enabled              bool          `json:"enabled"`
	RefreshInterval      time.Duration `json:"refresh_interval"`
	CacheEnabled         bool          `json:"cache_enabled"`
	CacheTTL             time.Duration `json:"cache_ttl"`
	RealTimeUpdates      bool          `json:"real_time_updates"`
	HistoricalDataDays   int           `json:"historical_data_days"`
	MaxDataPoints        int           `json:"max_data_points"`
	AlertingEnabled      bool          `json:"alerting_enabled"`
	ExportEnabled        bool          `json:"export_enabled"`
	CustomMetricsEnabled bool          `json:"custom_metrics_enabled"`
}

DashboardConfig configuration for compliance dashboard

type DashboardLayout

type DashboardLayout struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Widgets     []DashboardWidget `json:"widgets"`
	CreatedBy   string            `json:"created_by"`
	CreatedAt   time.Time         `json:"created_at"`
	UpdatedAt   time.Time         `json:"updated_at"`
	IsDefault   bool              `json:"is_default"`
	Permissions []string          `json:"permissions"`
}

DashboardLayout represents dashboard layout

type DashboardMetrics

type DashboardMetrics struct {
	Timestamp          time.Time           `json:"timestamp"`
	ComplianceMetrics  *ComplianceMetrics  `json:"compliance_metrics"`
	RiskMetrics        *RiskMetrics        `json:"risk_metrics"`
	AuditMetrics       *AuditMetrics       `json:"audit_metrics"`
	PerformanceMetrics *PerformanceMetrics `json:"performance_metrics"`
	CustomMetrics      []*CustomMetric     `json:"custom_metrics"`
	Alerts             []*DashboardAlert   `json:"alerts"`
	Summary            *DashboardSummary   `json:"summary"`
}

DashboardMetrics represents comprehensive dashboard metrics

type DashboardSummary

type DashboardSummary struct {
	OverallHealth    string             `json:"overall_health"`
	ComplianceStatus string             `json:"compliance_status"`
	RiskStatus       string             `json:"risk_status"`
	AuditStatus      string             `json:"audit_status"`
	ActiveAlerts     int                `json:"active_alerts"`
	CriticalIssues   int                `json:"critical_issues"`
	TrendDirection   string             `json:"trend_direction"`
	LastUpdated      time.Time          `json:"last_updated"`
	KeyMetrics       map[string]float64 `json:"key_metrics"`
	Recommendations  []string           `json:"recommendations"`
	Metadata         map[string]any     `json:"metadata"`
}

DashboardSummary represents a summary of dashboard data

type DashboardWidget

type DashboardWidget struct {
	ID          string         `json:"id"`
	Type        string         `json:"type"`
	Title       string         `json:"title"`
	Description string         `json:"description"`
	Position    WidgetPosition `json:"position"`
	Size        WidgetSize     `json:"size"`
	Config      WidgetConfig   `json:"config"`
	Data        any            `json:"data"`
	LastUpdated time.Time      `json:"last_updated"`
	Metadata    map[string]any `json:"metadata"`
}

DashboardWidget represents a dashboard widget

type DataAccessLog

type DataAccessLog struct {
	DataType       string    `json:"data_type"`
	Classification string    `json:"classification"`
	Action         string    `json:"action"` // read, write, delete, export
	RecordCount    int       `json:"record_count"`
	Fields         []string  `json:"fields,omitempty"`
	Timestamp      time.Time `json:"timestamp"`
	Purpose        string    `json:"purpose,omitempty"`
}

DataAccessLog represents data access for audit trails

type DataAccessRequest

type DataAccessRequest struct {
	ID            string                `json:"id"`
	DataSubjectID string                `json:"data_subject_id"`
	Email         string                `json:"email"`
	RequestDate   time.Time             `json:"request_date"`
	RequestType   string                `json:"request_type"` // "access", "portability", "erasure", "rectification", "objection"
	Scope         []string              `json:"scope"`
	Verification  *IdentityVerification `json:"verification"`
	Status        string                `json:"status"`
	DueDate       time.Time             `json:"due_date"`
	// Additional fields needed by tests
	Timestamp   time.Time      `json:"timestamp,omitempty"`
	ContactInfo string         `json:"contact_info,omitempty"`
	UserID      string         `json:"user_id,omitempty"`
	Purpose     string         `json:"purpose,omitempty"`
	Region      string         `json:"region,omitempty"`
	Metadata    map[string]any `json:"metadata"`
}

DataAccessRequest represents a data subject access request

type DataAccessResponse

type DataAccessResponse struct {
	RequestID      string         `json:"request_id"`
	ResponseDate   time.Time      `json:"response_date"`
	Data           map[string]any `json:"data"`
	DataSources    []string       `json:"data_sources"`
	Format         string         `json:"format"`
	DeliveryMethod string         `json:"delivery_method"`
	Encrypted      bool           `json:"encrypted"`
	// Additional fields needed by tests
	Status   string         `json:"status,omitempty"`
	Metadata map[string]any `json:"metadata"`
}

DataAccessResponse represents the response to a data access request

type DataAccessResult

type DataAccessResult struct {
	Allowed       bool           `json:"allowed"`
	Data          any            `json:"data,omitempty"`
	MaskedData    any            `json:"masked_data,omitempty"`
	Restrictions  []string       `json:"restrictions,omitempty"`
	Violations    []string       `json:"violations,omitempty"`
	AuditRequired bool           `json:"audit_required"`
	ExpiresAt     time.Time      `json:"expires_at,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
}

DataAccessResult represents the result of a data access request

type DataAggregator

type DataAggregator interface {
	AggregateByTimeframe(ctx context.Context, data []DataPoint, interval time.Duration) ([]AggregatedDataPoint, error)
	AggregateByDimension(ctx context.Context, data []DataPoint, dimension string) (map[string]float64, error)
	CalculateTrends(ctx context.Context, data []DataPoint) (*TrendAnalysis, error)
	GenerateSummary(ctx context.Context, data []DataPoint) (*DataSummary, error)
}

DataAggregator interface for data aggregation

type DataClassification

type DataClassification string

DataClassification defines data sensitivity levels

const (
	DataPublic       DataClassification = "public"
	DataInternal     DataClassification = "internal"
	DataConfidential DataClassification = "confidential"
	DataRestricted   DataClassification = "restricted"
)

type DataContext

type DataContext struct {
	Data           any                           `json:"data"`
	Classification DataClassification            `json:"classification"`
	Fields         map[string]DataClassification `json:"fields"`
	Metadata       map[string]any                `json:"metadata"`
	Timestamp      time.Time                     `json:"timestamp"`
	UserID         string                        `json:"user_id"`
	TenantID       string                        `json:"tenant_id"`
	Region         string                        `json:"region"`
	Purpose        string                        `json:"purpose"`
}

DataContext represents data with its classification and metadata

type DataDeletionProvider

type DataDeletionProvider interface {
	Name() string
	DeleteUserData(ctx context.Context, request *DataDeletionRequest) (*DataDeletionResult, error)
	IsRequired() bool // Whether failure of this provider should fail the entire operation
}

DataDeletionProvider interface for different data stores

type DataDeletionRequest

type DataDeletionRequest struct {
	DataSubjectID  string    `json:"data_subject_id"`
	TenantID       string    `json:"tenant_id"`
	ErasureScope   []string  `json:"erasure_scope"`
	RetainForLegal bool      `json:"retain_for_legal"`
	RequestID      string    `json:"request_id"`
	Timestamp      time.Time `json:"timestamp"`
}

DataDeletionRequest represents a request to delete user data

type DataDeletionResult

type DataDeletionResult struct {
	ProviderName      string        `json:"provider_name"`
	DeletedRecords    int           `json:"deleted_records"`
	RetainedRecords   int           `json:"retained_records"`
	DeletedDataTypes  []string      `json:"deleted_data_types"`
	RetainedDataTypes []string      `json:"retained_data_types"`
	RetentionReasons  []string      `json:"retention_reasons"`
	ProcessingTime    time.Duration `json:"processing_time"`
	Success           bool          `json:"success"`
	ErrorMessage      string        `json:"error_message,omitempty"`
}

DataDeletionResult represents the result of a data deletion operation

type DataErasureRequest

type DataErasureRequest struct {
	DataAccessRequest
	ErasureScope   []string `json:"erasure_scope"`
	RetainForLegal bool     `json:"retain_for_legal"`
	Reason         string   `json:"reason"`
}

DataErasureRequest represents a data erasure request

type DataErasureResponse

type DataErasureResponse struct {
	RequestID          string    `json:"request_id"`
	ResponseDate       time.Time `json:"response_date"`
	ErasedData         []string  `json:"erased_data"`
	RetainedData       []string  `json:"retained_data"`
	RetentionReason    string    `json:"retention_reason,omitempty"`
	ThirdPartyNotified bool      `json:"third_party_notified"`
	// Additional fields needed by tests
	Status       string         `json:"status,omitempty"`
	DataDeleted  []string       `json:"data_deleted,omitempty"`
	DeletedCount int            `json:"deleted_count,omitempty"`
	Metadata     map[string]any `json:"metadata"`
}

DataErasureResponse represents the response to a data erasure request

type DataObjectionRequest

type DataObjectionRequest struct {
	DataAccessRequest
	ProcessingPurposes []string `json:"processing_purposes"`
	ObjectionReason    string   `json:"objection_reason"`
	LegalGrounds       string   `json:"legal_grounds"`
}

DataObjectionRequest represents a data processing objection request

type DataObjectionResponse

type DataObjectionResponse struct {
	RequestID           string         `json:"request_id"`
	ResponseDate        time.Time      `json:"response_date"`
	ProcessingStopped   bool           `json:"processing_stopped"`
	ContinuedProcessing []string       `json:"continued_processing,omitempty"`
	LegalJustification  string         `json:"legal_justification,omitempty"`
	Metadata            map[string]any `json:"metadata"`
}

DataObjectionResponse represents the response to a data objection request

type DataPoint

type DataPoint struct {
	Timestamp time.Time         `json:"timestamp"`
	Value     float64           `json:"value"`
	Labels    map[string]string `json:"labels"`
	Metadata  map[string]any    `json:"metadata"`
}

DataPoint represents a generic data point

type DataPortabilityRequest

type DataPortabilityRequest struct {
	DataAccessRequest
	TargetController string `json:"target_controller,omitempty"`
	Format           string `json:"format"` // "json", "xml", "csv"
	StructuredData   bool   `json:"structured_data"`
}

DataPortabilityRequest represents a data portability request

type DataPortabilityResponse

type DataPortabilityResponse struct {
	RequestID      string         `json:"request_id"`
	ResponseDate   time.Time      `json:"response_date"`
	Data           map[string]any `json:"data"`
	Format         string         `json:"format"`
	StructuredData bool           `json:"structured_data"`
	TransferMethod string         `json:"transfer_method"`
	Metadata       map[string]any `json:"metadata"`
}

DataPortabilityResponse represents the response to a data portability request

type DataProcessingActivity

type DataProcessingActivity struct {
	ID                string          `json:"id"`
	Name              string          `json:"name"`
	Description       string          `json:"description"`
	Controller        string          `json:"controller"`
	Processor         string          `json:"processor,omitempty"`
	Purposes          []string        `json:"purposes"`
	LegalBasis        []string        `json:"legal_basis"`
	DataCategories    []string        `json:"data_categories"`
	DataSubjects      []string        `json:"data_subjects"`
	Recipients        []DataRecipient `json:"recipients"`
	ThirdCountries    []string        `json:"third_countries"`
	Safeguards        []string        `json:"safeguards"`
	RetentionPeriod   time.Duration   `json:"retention_period"`
	SecurityMeasures  []string        `json:"security_measures"`
	DataSources       []string        `json:"data_sources"`
	AutomatedDecision bool            `json:"automated_decision"`
	Profiling         bool            `json:"profiling"`
	HighRisk          bool            `json:"high_risk"`
	PIARequired       bool            `json:"pia_required"`
	PIACompleted      bool            `json:"pia_completed"`
	LastReview        time.Time       `json:"last_review"`
	NextReview        time.Time       `json:"next_review"`
	Metadata          map[string]any  `json:"metadata"`
}

DataProcessingActivity represents a data processing activity

type DataProcessingLog

type DataProcessingLog struct {
	ProcessingID      string         `json:"processing_id"`
	DataSubject       string         `json:"data_subject"`
	ProcessingPurpose string         `json:"processing_purpose"`
	LegalBasis        string         `json:"legal_basis"`
	DataCategories    []string       `json:"data_categories"`
	Recipients        []string       `json:"recipients"`
	ThirdCountries    []string       `json:"third_countries"`
	RetentionPeriod   time.Duration  `json:"retention_period"`
	SecurityMeasures  []string       `json:"security_measures"`
	ConsentDetails    *ConsentData   `json:"consent_details"`
	Metadata          map[string]any `json:"metadata"`
	Timestamp         time.Time      `json:"timestamp"`
}

DataProcessingLog for GDPR data processing logging

type DataProtectionConfig

type DataProtectionConfig struct {
	DefaultClassification DataClassification                   `json:"default_classification"`
	FieldClassifications  map[string]DataClassification        `json:"field_classifications"`
	EncryptionKey         string                               `json:"encryption_key"`
	RegionRestrictions    map[DataClassification][]string      `json:"region_restrictions"`
	RetentionPolicies     map[DataClassification]time.Duration `json:"retention_policies"`
	AccessControls        map[DataClassification][]string      `json:"access_controls"`
	MaskingRules          map[string]MaskingRule               `json:"masking_rules"`
}

DataProtectionConfig holds configuration for data protection

type DataProtectionData

type DataProtectionData struct {
	DataClassification string        `json:"data_classification"`
	EncryptionMethod   string        `json:"encryption_method"`
	EncryptionStrength string        `json:"encryption_strength"`
	KeyManagement      string        `json:"key_management"`
	DataLocation       []string      `json:"data_location"`
	BackupEncrypted    bool          `json:"backup_encrypted"`
	TransitEncryption  bool          `json:"transit_encryption"`
	RestEncryption     bool          `json:"rest_encryption"`
	DataMasking        bool          `json:"data_masking"`
	RetentionPeriod    time.Duration `json:"retention_period"`
}

DataProtectionData for data protection controls

type DataProtectionManager

type DataProtectionManager struct {
	// contains filtered or unexported fields
}

DataProtectionManager handles data classification and protection

func GetDataProtectionManager

func GetDataProtectionManager(ctx LiftContext) (*DataProtectionManager, error)

GetDataProtectionManager retrieves the data protection manager from context

func NewDataProtectionManager

func NewDataProtectionManager(config DataProtectionConfig) (*DataProtectionManager, error)

NewDataProtectionManager creates a new data protection manager

func (*DataProtectionManager) ClassifyData

func (dpm *DataProtectionManager) ClassifyData(data any, context map[string]any) *DataContext

ClassifyData classifies data based on content and configuration

func (*DataProtectionManager) ProtectData

func (dpm *DataProtectionManager) ProtectData(dataCtx *DataContext, accessRequest DataProtectionRequest) (*DataAccessResult, error)

ProtectData applies protection measures to data based on classification

func (*DataProtectionManager) ValidateDataAccess

func (dpm *DataProtectionManager) ValidateDataAccess(request DataProtectionRequest) *DataAccessResult

ValidateDataAccess validates if data access is allowed

func (*DataProtectionManager) ValidateDataAccessFromGDPR

func (dpm *DataProtectionManager) ValidateDataAccessFromGDPR(request any) *DataAccessResult

ValidateDataAccessFromGDPR validates data access from a GDPR DataAccessRequest

type DataProtectionRequest

type DataProtectionRequest struct {
	UserID         string             `json:"user_id"`
	TenantID       string             `json:"tenant_id"`
	DataType       string             `json:"data_type"`
	Classification DataClassification `json:"classification"`
	Purpose        string             `json:"purpose"`
	Region         string             `json:"region"`
	Fields         []string           `json:"fields"`
	Metadata       map[string]any     `json:"metadata"`
}

DataProtectionRequest represents a request to access protected data

type DataRecipient

type DataRecipient struct {
	ID         string   `json:"id"`
	Name       string   `json:"name"`
	Type       string   `json:"type"` // "controller", "processor", "third_party"
	Country    string   `json:"country"`
	Purposes   []string `json:"purposes"`
	Safeguards []string `json:"safeguards"`
}

DataRecipient represents a recipient of personal data

type DataRectificationRequest

type DataRectificationRequest struct {
	DataAccessRequest
	IncorrectData map[string]any `json:"incorrect_data"`
	CorrectedData map[string]any `json:"corrected_data"`
}

DataRectificationRequest represents a data rectification request

type DataRectificationResponse

type DataRectificationResponse struct {
	RequestID          string         `json:"request_id"`
	ResponseDate       time.Time      `json:"response_date"`
	RectifiedData      map[string]any `json:"rectified_data"`
	ThirdPartyNotified bool           `json:"third_party_notified"`
	Metadata           map[string]any `json:"metadata"`
}

DataRectificationResponse represents the response to a data rectification request

type DataSubjectRequestLog

type DataSubjectRequestLog struct {
	RequestID     string         `json:"request_id"`
	RequestType   string         `json:"request_type"`
	DataSubjectID string         `json:"data_subject_id"`
	Timestamp     time.Time      `json:"timestamp"`
	Status        string         `json:"status"`
	ProcessedBy   string         `json:"processed_by"`
	Details       map[string]any `json:"details"`
	Metadata      map[string]any `json:"metadata"`
}

DataSubjectRequestLog represents a data subject request for audit logging

type DataSubjectRightsHandler

type DataSubjectRightsHandler interface {
	HandleAccessRequest(ctx context.Context, request *DataAccessRequest) (*DataAccessResponse, error)
	HandlePortabilityRequest(ctx context.Context, request *DataPortabilityRequest) (*DataPortabilityResponse, error)
	HandleErasureRequest(ctx context.Context, request *DataErasureRequest) (*DataErasureResponse, error)
	HandleRectificationRequest(ctx context.Context, request *DataRectificationRequest) (*DataRectificationResponse, error)
	HandleObjectionRequest(ctx context.Context, request *DataObjectionRequest) (*DataObjectionResponse, error)
	GetRequestStatus(ctx context.Context, requestID string) (*RequestStatus, error)
}

DataSubjectRightsHandler interface for handling data subject rights

type DataSummary

type DataSummary struct {
	Count       int                `json:"count"`
	Min         float64            `json:"min"`
	Max         float64            `json:"max"`
	Average     float64            `json:"average"`
	Median      float64            `json:"median"`
	StdDev      float64            `json:"std_dev"`
	Percentiles map[string]float64 `json:"percentiles"`
	Metadata    map[string]any     `json:"metadata"`
}

DataSummary represents a summary of data

type DataTokenizer

type DataTokenizer struct {
	// contains filtered or unexported fields
}

DataTokenizer handles data tokenization for PCI compliance

func NewDataTokenizer

func NewDataTokenizer() *DataTokenizer

NewDataTokenizer creates a new data tokenizer

func (*DataTokenizer) Detokenize

func (dt *DataTokenizer) Detokenize(token string) (string, error)

Detokenize retrieves original data from token

func (*DataTokenizer) Tokenize

func (dt *DataTokenizer) Tokenize(data string) (string, error)

Tokenize creates a token for sensitive data

type EcommerceComplianceConfig

type EcommerceComplianceConfig struct {
	PCIDSSRequired     bool     `json:"pci_dss_required"`
	GDPRRequired       bool     `json:"gdpr_required"`
	CCPARequired       bool     `json:"ccpa_required"`
	COPPARequired      bool     `json:"coppa_required"`          // Children's Online Privacy Protection Act
	AccessibilityStds  []string `json:"accessibility_standards"` // WCAG, ADA
	ConsumerProtection bool     `json:"consumer_protection"`
	DataPortability    bool     `json:"data_portability"`
	CookieConsent      bool     `json:"cookie_consent"`
	MarketingConsent   bool     `json:"marketing_consent"`
	PaymentSecurity    string   `json:"payment_security_level"`
	FraudPrevention    bool     `json:"fraud_prevention"`
	TaxCompliance      []string `json:"tax_compliance"`
	CrossBorderRules   []string `json:"cross_border_rules"`
}

EcommerceComplianceConfig configuration for e-commerce compliance

type EcommerceComplianceTemplate

type EcommerceComplianceTemplate struct {
	// contains filtered or unexported fields
}

EcommerceComplianceTemplate for e-commerce compliance

func NewEcommerceComplianceTemplate

func NewEcommerceComplianceTemplate(config EcommerceComplianceConfig) *EcommerceComplianceTemplate

NewEcommerceComplianceTemplate creates a new e-commerce compliance template

func (*EcommerceComplianceTemplate) GenerateComplianceReport

func (ect *EcommerceComplianceTemplate) GenerateComplianceReport() (*IndustryComplianceReport, error)

GenerateComplianceReport generates an e-commerce compliance report

func (*EcommerceComplianceTemplate) GetAudits

func (ect *EcommerceComplianceTemplate) GetAudits() []AuditRequirement

GetAudits returns audit requirements

func (*EcommerceComplianceTemplate) GetComplianceMiddleware

func (ect *EcommerceComplianceTemplate) GetComplianceMiddleware() []LiftMiddleware

GetComplianceMiddleware returns compliance middleware

func (*EcommerceComplianceTemplate) GetControls

func (ect *EcommerceComplianceTemplate) GetControls() []ComplianceControl

GetControls returns compliance controls

func (*EcommerceComplianceTemplate) GetIndustry

func (ect *EcommerceComplianceTemplate) GetIndustry() string

GetIndustry returns the industry name

func (*EcommerceComplianceTemplate) GetRegulations

func (ect *EcommerceComplianceTemplate) GetRegulations() []string

GetRegulations returns applicable regulations

func (*EcommerceComplianceTemplate) GetRiskAssessments

func (ect *EcommerceComplianceTemplate) GetRiskAssessments() []RiskAssessmentTemplate

GetRiskAssessments returns risk assessment templates

func (*EcommerceComplianceTemplate) ValidateCompliance

func (ect *EcommerceComplianceTemplate) ValidateCompliance(ctx LiftContext) (*ComplianceResult, error)

ValidateCompliance validates compliance for e-commerce

type EncryptedCachedSecret

type EncryptedCachedSecret struct {
	EncryptedValue []byte // AES-256-GCM encrypted value
	Nonce          []byte // GCM nonce
	ExpiresAt      time.Time
}

EncryptedCachedSecret represents an encrypted cached secret with expiration

type EncryptedSecretCache

type EncryptedSecretCache struct {
	// contains filtered or unexported fields
}

EncryptedSecretCache provides encrypted in-memory caching for secrets with TTL

func NewEncryptedSecretCache

func NewEncryptedSecretCache(ttl time.Duration, encryptionKey []byte) (*EncryptedSecretCache, error)

NewEncryptedSecretCache creates a new encrypted secret cache with the specified TTL

func (*EncryptedSecretCache) Clear

func (c *EncryptedSecretCache) Clear()

Clear removes all values from the cache and clears encryption keys

func (*EncryptedSecretCache) Delete

func (c *EncryptedSecretCache) Delete(key string)

Delete removes a value from the cache

func (*EncryptedSecretCache) Get

func (c *EncryptedSecretCache) Get(key string) (string, error)

Get retrieves and decrypts a value from the cache

func (*EncryptedSecretCache) GetCacheInfo

func (c *EncryptedSecretCache) GetCacheInfo() map[string]any

GetCacheInfo returns cache statistics (for monitoring)

func (*EncryptedSecretCache) Set

func (c *EncryptedSecretCache) Set(key, value string) error

Set encrypts and stores a value in the cache with TTL

func (*EncryptedSecretCache) Size

func (c *EncryptedSecretCache) Size() int

Size returns the number of cached secrets

type EnhancedAuditConfig

type EnhancedAuditConfig struct {
	DetailedLogging     bool          `json:"detailed_logging"`
	RealTimeMonitoring  bool          `json:"real_time_monitoring"`
	AnomalyDetection    bool          `json:"anomaly_detection"`
	ThreatIntelligence  bool          `json:"threat_intelligence"`
	AutomatedResponse   bool          `json:"automated_response"`
	RetentionPeriod     time.Duration `json:"retention_period"`
	EncryptionRequired  bool          `json:"encryption_required"`
	IntegrityValidation bool          `json:"integrity_validation"`
}

EnhancedAuditConfig for advanced audit capabilities

type EnhancedAuditLogger

type EnhancedAuditLogger interface {
	AuditLogger // Embed base interface
	StartSOC2Audit(ctx LiftContext) string
	LogSecurityControls(auditID string, controls *SOC2Controls) error
	LogGDPREvent(auditID string, event *GDPREvent) error
	LogComplianceTest(auditID string, test *ComplianceTestResult) error
	LogDataProcessing(auditID string, processing *DataProcessingLog) error
	CompleteSOC2Audit(auditID string, result any, err error) error
}

EnhancedAuditLogger provides advanced audit capabilities

type EnhancedComplianceConfig

type EnhancedComplianceConfig struct {
	ComplianceConfig                     // Embed base config
	SOC2TypeII       SOC2TypeIIConfig    `json:"soc2_type_ii"`
	GDPR             GDPRConfig          `json:"gdpr"`
	IndustryTemplate IndustryTemplate    `json:"industry_template"`
	AuditEnhanced    EnhancedAuditConfig `json:"audit_enhanced"`
}

EnhancedComplianceConfig holds advanced configuration

type EnhancedComplianceFramework

type EnhancedComplianceFramework struct {
	// contains filtered or unexported fields
}

EnhancedComplianceFramework provides advanced compliance automation

func NewEnhancedComplianceFramework

func NewEnhancedComplianceFramework(framework string, config EnhancedComplianceConfig) *EnhancedComplianceFramework

NewEnhancedComplianceFramework creates a new enhanced compliance framework

func (*EnhancedComplianceFramework) AddIndustryTemplate

func (ecf *EnhancedComplianceFramework) AddIndustryTemplate(industry string, template ComplianceTemplate)

AddIndustryTemplate adds an industry-specific compliance template

func (*EnhancedComplianceFramework) ApplyIndustryTemplate

func (ecf *EnhancedComplianceFramework) ApplyIndustryTemplate(industry string) ([]LiftMiddleware, error)

ApplyIndustryTemplate applies industry-specific compliance template

func (*EnhancedComplianceFramework) GDPRPrivacy

func (ecf *EnhancedComplianceFramework) GDPRPrivacy() LiftMiddleware

GDPRPrivacy creates GDPR privacy compliance middleware

func (*EnhancedComplianceFramework) SOC2TypeII

func (ecf *EnhancedComplianceFramework) SOC2TypeII() LiftMiddleware

SOC2TypeII creates SOC 2 Type II compliance middleware

func (*EnhancedComplianceFramework) SetAdvancedValidator

func (ecf *EnhancedComplianceFramework) SetAdvancedValidator(validator AdvancedComplianceValidator)

SetAdvancedValidator sets the advanced compliance validator

func (*EnhancedComplianceFramework) SetEnhancedAuditor

func (ecf *EnhancedComplianceFramework) SetEnhancedAuditor(auditor EnhancedAuditLogger)

SetEnhancedAuditor sets the enhanced audit logger

type EventAnalysis

type EventAnalysis struct {
	EventID   string         `json:"event_id"`
	Timestamp time.Time      `json:"timestamp"`
	RiskScore *RiskScore     `json:"risk_score,omitempty"`
	Anomalies []*Anomaly     `json:"anomalies,omitempty"`
	Analyses  map[string]any `json:"analyses"`
}

EventAnalysis represents the analysis of an event

type Evidence

type Evidence struct {
	ID          string         `json:"id"`
	Type        string         `json:"type"`
	Description string         `json:"description"`
	Source      string         `json:"source"`
	Timestamp   time.Time      `json:"timestamp"`
	Data        map[string]any `json:"data"`
	Verified    bool           `json:"verified"`
}

Evidence represents compliance evidence

type EvidenceCollector

type EvidenceCollector interface {
	CollectEvidence(ctx context.Context, control SOC2Control) (*ControlEvidence, error)
	CollectSystemEvidence(ctx context.Context) (*SystemEvidence, error)
	ValidateEvidence(evidence *ControlEvidence) (*EvidenceValidation, error)
	ArchiveEvidence(evidence *ControlEvidence) error
}

EvidenceCollector interface for automated evidence collection

type EvidenceRequirement

type EvidenceRequirement struct {
	Type        string `json:"type"`
	Description string `json:"description"`
	Required    bool   `json:"required"`
	Automated   bool   `json:"automated"`
}

EvidenceRequirement defines required evidence

type EvidenceValidation

type EvidenceValidation struct {
	Valid             bool      `json:"valid"`
	ValidationDate    time.Time `json:"validation_date"`
	ValidatedBy       string    `json:"validated_by"`
	Issues            []string  `json:"issues"`
	Recommendations   []string  `json:"recommendations"`
	IntegrityCheck    bool      `json:"integrity_check"`
	CompletenessCheck bool      `json:"completeness_check"`
	AccuracyCheck     bool      `json:"accuracy_check"`
}

EvidenceValidation represents evidence validation results

type ExceptionResolution

type ExceptionResolution struct {
	ResolvedDate     time.Time  `json:"resolved_date"`
	ResolvedBy       string     `json:"resolved_by"`
	ResolutionType   string     `json:"resolution_type"`
	Description      string     `json:"description"`
	ActionsToken     []string   `json:"actions_taken"`
	Verified         bool       `json:"verified"`
	VerifiedBy       string     `json:"verified_by"`
	VerificationDate *time.Time `json:"verification_date,omitempty"`
}

ExceptionResolution represents the resolution of an exception

type ExceptionTracker

type ExceptionTracker interface {
	RecordException(exception *ComplianceException) error
	GetExceptions(controlID string, since time.Time) ([]*ComplianceException, error)
	GetExceptionTrends() (*ExceptionTrends, error)
	ResolveException(exceptionID string, resolution *ExceptionResolution) error
}

ExceptionTracker interface for tracking compliance exceptions

type ExceptionTrends

type ExceptionTrends struct {
	Period                string         `json:"period"`
	TotalExceptions       int            `json:"total_exceptions"`
	OpenExceptions        int            `json:"open_exceptions"`
	ResolvedExceptions    int            `json:"resolved_exceptions"`
	ExceptionsByControl   map[string]int `json:"exceptions_by_control"`
	ExceptionsBySeverity  map[string]int `json:"exceptions_by_severity"`
	TrendDirection        string         `json:"trend_direction"`
	AverageResolutionTime time.Duration  `json:"average_resolution_time"`
	ComplianceRate        float64        `json:"compliance_rate"`
	Recommendations       []string       `json:"recommendations"`
}

ExceptionTrends represents exception trend analysis

type FeatureExtractionConfig

type FeatureExtractionConfig struct {
	EnabledFeatures     []string           `json:"enabled_features"`
	TemporalWindow      time.Duration      `json:"temporal_window"`
	BehavioralWindow    time.Duration      `json:"behavioral_window"`
	ContextualDepth     int                `json:"contextual_depth"`
	FeatureWeights      map[string]float64 `json:"feature_weights"`
	NormalizationMethod string             `json:"normalization_method"`
	Metadata            map[string]any     `json:"metadata"`
}

FeatureExtractionConfig configuration for feature extraction

type FeatureExtractor

type FeatureExtractor interface {
	Extract(event *AuditEvent, context *RiskContext) (float64, error)
	GetName() string
	GetDescription() string
	GetWeight() float64
}

FeatureExtractor interface for extracting specific features

type FileSecretsProvider

type FileSecretsProvider struct {
	// contains filtered or unexported fields
}

FileSecretsProvider implements SecretsProvider for local file-based secrets (development only)

func NewFileSecretsProvider

func NewFileSecretsProvider(basePath string) *FileSecretsProvider

NewFileSecretsProvider creates a file-based secrets provider for development

func NewFileSecretsProviderWithConfig

func NewFileSecretsProviderWithConfig(basePath string, enableRotation bool) *FileSecretsProvider

NewFileSecretsProviderWithConfig creates a file-based secrets provider with configuration

func (*FileSecretsProvider) ClearRotationHistory

func (fsp *FileSecretsProvider) ClearRotationHistory()

ClearRotationHistory clears all rotation history (testing utility)

func (*FileSecretsProvider) DeleteSecret

func (fsp *FileSecretsProvider) DeleteSecret(ctx context.Context, name string) error

DeleteSecret removes a secret from memory

func (*FileSecretsProvider) GetAllRotationHistory

func (fsp *FileSecretsProvider) GetAllRotationHistory() map[string][]RotationRecord

GetAllRotationHistory returns rotation history for all secrets (testing/debugging)

func (*FileSecretsProvider) GetRotationHistory

func (fsp *FileSecretsProvider) GetRotationHistory(name string) []RotationRecord

GetRotationHistory returns rotation history for a secret (testing/debugging)

func (*FileSecretsProvider) GetSecret

func (fsp *FileSecretsProvider) GetSecret(ctx context.Context, name string) (string, error)

GetSecret retrieves a secret from a file

func (*FileSecretsProvider) IsRotationEnabled

func (fsp *FileSecretsProvider) IsRotationEnabled() bool

IsRotationEnabled returns whether rotation is enabled

func (*FileSecretsProvider) PutSecret

func (fsp *FileSecretsProvider) PutSecret(ctx context.Context, name string, value string) error

PutSecret stores a secret in memory (file provider)

func (*FileSecretsProvider) RotateSecret

func (fsp *FileSecretsProvider) RotateSecret(ctx context.Context, name string) error

RotateSecret implements rotation for file provider with simulation

func (*FileSecretsProvider) SetRotationEnabled

func (fsp *FileSecretsProvider) SetRotationEnabled(enabled bool)

SetRotationEnabled enables or disables rotation for testing

func (*FileSecretsProvider) SimulateRotationFailure

func (fsp *FileSecretsProvider) SimulateRotationFailure(ctx context.Context, name string, errorMessage string) error

SimulateRotationFailure simulates a rotation failure for testing

type ForecastPoint

type ForecastPoint struct {
	Timestamp  time.Time `json:"timestamp"`
	Value      float64   `json:"value"`
	Confidence float64   `json:"confidence"`
	Lower      float64   `json:"lower"`
	Upper      float64   `json:"upper"`
}

ForecastPoint represents a forecast point

type GDPRAuditLogger

type GDPRAuditLogger interface {
	LogConsentEvent(ctx context.Context, event *ConsentEvent) error
	LogDataSubjectRequest(ctx context.Context, request *DataSubjectRequestLog) error
	LogDataProcessingActivity(ctx context.Context, activity *DataProcessingLog) error
	LogCrossBorderTransfer(ctx context.Context, transfer *CrossBorderTransferLog) error
	LogPrivacyBreach(ctx context.Context, breach *PrivacyBreachLog) error
}

GDPRAuditLogger interface for GDPR-specific audit logging

type GDPRConfig

type GDPRConfig struct {
	Enabled                 bool                     `json:"enabled"`
	DataProcessingBasis     []string                 `json:"data_processing_basis"`
	ConsentManagement       bool                     `json:"consent_management"`
	DataMinimization        bool                     `json:"data_minimization"`
	RightToBeForgotten      bool                     `json:"right_to_be_forgotten"`
	DataPortability         bool                     `json:"data_portability"`
	BreachNotificationHours int                      `json:"breach_notification_hours"`
	DPORequired             bool                     `json:"dpo_required"`
	PIARequired             bool                     `json:"pia_required"`
	DataRetentionPolicies   map[string]time.Duration `json:"data_retention_policies"`
}

GDPRConfig for GDPR privacy compliance

type GDPRConsentConfig

type GDPRConsentConfig struct {
	Enabled                  bool                     `json:"enabled"`
	ConsentRenewalDays       int                      `json:"consent_renewal_days"`
	AutomaticConsentRenewal  bool                     `json:"automatic_consent_renewal"`
	GranularConsentRequired  bool                     `json:"granular_consent_required"`
	ConsentWithdrawalEnabled bool                     `json:"consent_withdrawal_enabled"`
	DataPortabilityEnabled   bool                     `json:"data_portability_enabled"`
	RightToErasureEnabled    bool                     `json:"right_to_erasure_enabled"`
	BreachNotificationHours  int                      `json:"breach_notification_hours"`
	DataRetentionPolicies    map[string]time.Duration `json:"data_retention_policies"`
	CrossBorderTransferRules []CrossBorderRule        `json:"cross_border_transfer_rules"`
	PrivacyByDesignEnabled   bool                     `json:"privacy_by_design_enabled"`
	// Additional fields needed by tests
	ConsentExpiryDays      int  `json:"consent_expiry_days"`
	RequireExplicitConsent bool `json:"require_explicit_consent"`
	RequireConsentProof    bool `json:"require_consent_proof"`
	DataRetentionDays      int  `json:"data_retention_days"`
	RequestProcessingDays  int  `json:"request_processing_days"`
	ConsentProofRequired   bool `json:"consent_proof_required"`
}

GDPRConsentConfig configuration for GDPR consent management

type GDPRConsentManager

type GDPRConsentManager struct {
	// contains filtered or unexported fields
}

GDPRConsentManager provides comprehensive GDPR consent management

func NewGDPRConsentManager

func NewGDPRConsentManager(config GDPRConsentConfig) *GDPRConsentManager

NewGDPRConsentManager creates a new GDPR consent manager

func (*GDPRConsentManager) ConductPIA

func (gcm *GDPRConsentManager) ConductPIA(ctx context.Context, request *PIARequest) (*PIAResult, error)

ConductPIA conducts a privacy impact assessment

func (*GDPRConsentManager) GetConsent

func (gcm *GDPRConsentManager) GetConsent(ctx context.Context, dataSubjectID, purpose string) (*ConsentRecord, error)

GetConsent retrieves consent for a data subject and purpose

func (*GDPRConsentManager) HandleAccessRequest

func (gcm *GDPRConsentManager) HandleAccessRequest(ctx context.Context, request *DataAccessRequest) (*DataAccessResponse, error)

HandleAccessRequest handles a data access request

func (*GDPRConsentManager) HandleErasureRequest

func (gcm *GDPRConsentManager) HandleErasureRequest(ctx context.Context, request *DataErasureRequest) (*DataErasureResponse, error)

HandleErasureRequest handles a data erasure request

func (*GDPRConsentManager) ProcessDataSubjectRequest

func (gcm *GDPRConsentManager) ProcessDataSubjectRequest(ctx context.Context, request *DataAccessRequest) error

ProcessDataSubjectRequest processes a data subject request

func (*GDPRConsentManager) RecordConsent

func (gcm *GDPRConsentManager) RecordConsent(ctx context.Context, consent *ConsentRecord) error

RecordConsent records a new consent

func (*GDPRConsentManager) SetAuditLogger

func (gcm *GDPRConsentManager) SetAuditLogger(logger GDPRAuditLogger)

SetAuditLogger sets the GDPR audit logger

func (*GDPRConsentManager) SetConsentStore

func (gcm *GDPRConsentManager) SetConsentStore(store ConsentStore)

SetConsentStore sets the consent store

func (*GDPRConsentManager) SetCrossBorderValidator

func (gcm *GDPRConsentManager) SetCrossBorderValidator(validator CrossBorderValidator)

SetCrossBorderValidator sets the cross-border validator

func (*GDPRConsentManager) SetDataSubjectRightsHandler

func (gcm *GDPRConsentManager) SetDataSubjectRightsHandler(handler DataSubjectRightsHandler)

SetDataSubjectRightsHandler sets the data subject rights handler

func (*GDPRConsentManager) SetPrivacyImpactAssessment

func (gcm *GDPRConsentManager) SetPrivacyImpactAssessment(pia PrivacyImpactAssessment)

SetPrivacyImpactAssessment sets the privacy impact assessment handler

func (*GDPRConsentManager) UpdateConsent

func (gcm *GDPRConsentManager) UpdateConsent(ctx context.Context, consentID string, updates *ConsentUpdate) error

UpdateConsent updates an existing consent

func (*GDPRConsentManager) WithdrawConsent

func (gcm *GDPRConsentManager) WithdrawConsent(ctx context.Context, consentID string, withdrawal *ConsentWithdrawal) error

WithdrawConsent withdraws consent

type GDPREvent

type GDPREvent struct {
	EventType        string         `json:"event_type"`
	DataSubject      string         `json:"data_subject"`
	DataController   string         `json:"data_controller"`
	DataProcessor    string         `json:"data_processor"`
	ProcessingBasis  string         `json:"processing_basis"`
	DataCategories   []string       `json:"data_categories"`
	Recipients       []string       `json:"recipients"`
	RetentionPeriod  time.Duration  `json:"retention_period"`
	ConsentGiven     bool           `json:"consent_given"`
	ConsentWithdrawn bool           `json:"consent_withdrawn"`
	DataPortability  bool           `json:"data_portability"`
	RightToErasure   bool           `json:"right_to_erasure"`
	Metadata         map[string]any `json:"metadata"`
	Timestamp        time.Time      `json:"timestamp"`
}

GDPREvent represents GDPR-related events

type GovernmentComplianceConfig

type GovernmentComplianceConfig struct {
	FedRAMPLevel         string `json:"fedramp_level"` // "Low", "Moderate", "High"
	FISMARequired        bool   `json:"fisma_required"`
	NISTFramework        string `json:"nist_framework"`  // "800-53", "800-171", "CSF"
	ATORequired          bool   `json:"ato_required"`    // Authority to Operate
	STIGCompliance       bool   `json:"stig_compliance"` // Security Technical Implementation Guides
	ILLevel              string `json:"il_level"`        // Impact Level
	CUIHandling          bool   `json:"cui_handling"`    // Controlled Unclassified Information
	PIIProtection        bool   `json:"pii_protection"`
	Section508           bool   `json:"section_508"` // Accessibility
	FOIA                 bool   `json:"foia"`        // Freedom of Information Act
	RecordsManagement    bool   `json:"records_management"`
	IncidentReporting    bool   `json:"incident_reporting"`
	ContinuousMonitoring bool   `json:"continuous_monitoring"`
}

GovernmentComplianceConfig configuration for government compliance

type GovernmentComplianceTemplate

type GovernmentComplianceTemplate struct {
	// contains filtered or unexported fields
}

GovernmentComplianceTemplate for government sector compliance

func NewGovernmentComplianceTemplate

func NewGovernmentComplianceTemplate(config GovernmentComplianceConfig) *GovernmentComplianceTemplate

NewGovernmentComplianceTemplate creates a new government compliance template

func (*GovernmentComplianceTemplate) GenerateComplianceReport

func (gct *GovernmentComplianceTemplate) GenerateComplianceReport() (*IndustryComplianceReport, error)

GenerateComplianceReport generates a government compliance report

func (*GovernmentComplianceTemplate) GetAudits

GetAudits returns audit requirements

func (*GovernmentComplianceTemplate) GetComplianceMiddleware

func (gct *GovernmentComplianceTemplate) GetComplianceMiddleware() []LiftMiddleware

GetComplianceMiddleware returns compliance middleware

func (*GovernmentComplianceTemplate) GetControls

func (gct *GovernmentComplianceTemplate) GetControls() []ComplianceControl

GetControls returns compliance controls

func (*GovernmentComplianceTemplate) GetIndustry

func (gct *GovernmentComplianceTemplate) GetIndustry() string

GetIndustry returns the industry name

func (*GovernmentComplianceTemplate) GetRegulations

func (gct *GovernmentComplianceTemplate) GetRegulations() []string

GetRegulations returns applicable regulations

func (*GovernmentComplianceTemplate) GetRiskAssessments

func (gct *GovernmentComplianceTemplate) GetRiskAssessments() []RiskAssessmentTemplate

GetRiskAssessments returns risk assessment templates

func (*GovernmentComplianceTemplate) ValidateCompliance

func (gct *GovernmentComplianceTemplate) ValidateCompliance(ctx LiftContext) (*ComplianceResult, error)

ValidateCompliance validates compliance for government

type HealthcareComplianceConfig

type HealthcareComplianceConfig struct {
	HIPAARequired        bool     `json:"hipaa_required"`
	HITECHRequired       bool     `json:"hitech_required"`
	FDACompliance        bool     `json:"fda_compliance"`
	DEACompliance        bool     `json:"dea_compliance"`
	PHIProtectionLevel   string   `json:"phi_protection_level"`
	BAAAgreements        bool     `json:"baa_agreements"` // Business Associate Agreements
	BreachNotification   bool     `json:"breach_notification"`
	AccessLogging        bool     `json:"access_logging"`
	DataMinimization     bool     `json:"data_minimization"`
	ConsentManagement    bool     `json:"consent_management"`
	InteroperabilityStds []string `json:"interoperability_standards"`
	ClinicalTrialData    bool     `json:"clinical_trial_data"`
	MedicalDeviceData    bool     `json:"medical_device_data"`
}

HealthcareComplianceConfig configuration for healthcare compliance

type HealthcareComplianceTemplate

type HealthcareComplianceTemplate struct {
	// contains filtered or unexported fields
}

HealthcareComplianceTemplate for healthcare compliance

func NewHealthcareComplianceTemplate

func NewHealthcareComplianceTemplate(config HealthcareComplianceConfig) *HealthcareComplianceTemplate

NewHealthcareComplianceTemplate creates a new healthcare compliance template

func (*HealthcareComplianceTemplate) GenerateComplianceReport

func (hct *HealthcareComplianceTemplate) GenerateComplianceReport() (*IndustryComplianceReport, error)

GenerateComplianceReport generates a healthcare compliance report

func (*HealthcareComplianceTemplate) GetAudits

GetAudits returns audit requirements

func (*HealthcareComplianceTemplate) GetComplianceMiddleware

func (hct *HealthcareComplianceTemplate) GetComplianceMiddleware() []LiftMiddleware

GetComplianceMiddleware returns compliance middleware

func (*HealthcareComplianceTemplate) GetControls

func (hct *HealthcareComplianceTemplate) GetControls() []ComplianceControl

GetControls returns compliance controls

func (*HealthcareComplianceTemplate) GetIndustry

func (hct *HealthcareComplianceTemplate) GetIndustry() string

GetIndustry returns the industry name

func (*HealthcareComplianceTemplate) GetRegulations

func (hct *HealthcareComplianceTemplate) GetRegulations() []string

GetRegulations returns applicable regulations

func (*HealthcareComplianceTemplate) GetRiskAssessments

func (hct *HealthcareComplianceTemplate) GetRiskAssessments() []RiskAssessmentTemplate

GetRiskAssessments returns risk assessment templates

func (*HealthcareComplianceTemplate) ValidateCompliance

func (hct *HealthcareComplianceTemplate) ValidateCompliance(ctx LiftContext) (*ComplianceResult, error)

ValidateCompliance validates compliance for healthcare

type IPAuthorizationConfig added in v1.0.36

type IPAuthorizationConfig struct {
	// AllowedIPs is a list of IP addresses that are authorized
	AllowedIPs []string
	// AllowedIPList is a comma-separated string of allowed IPs (alternative format)
	AllowedIPList string
}

IPAuthorizationConfig holds configuration for IP authorization

type IPAuthorizationService added in v1.0.36

type IPAuthorizationService struct {
	// contains filtered or unexported fields
}

IPAuthorizationService provides a generic interface for IP authorization

func NewIPAuthorizationService added in v1.0.36

func NewIPAuthorizationService(ssmClient *ssm.Client, ssmParameterName string) *IPAuthorizationService

NewIPAuthorizationService creates a new IP authorization service

func NewIPAuthorizationServiceFromEnv added in v1.0.36

func NewIPAuthorizationServiceFromEnv(ctx context.Context, component string) (*IPAuthorizationService, error)

NewIPAuthorizationServiceFromEnv creates a new IP authorization service using environment variables It requires PARTNER and STAGE env vars, and the component name must be provided

func (*IPAuthorizationService) IsAuthorizedIP added in v1.0.36

func (s *IPAuthorizationService) IsAuthorizedIP(ctx context.Context, sourceIP string) (bool, error)

IsAuthorizedIP checks if the given IP is authorized

type IPExtractionError added in v1.0.36

type IPExtractionError struct {
	Message string
	Headers map[string]string
}

IPExtractionError represents an error during IP extraction

func (*IPExtractionError) Error added in v1.0.36

func (e *IPExtractionError) Error() string

type IdentityVerification

type IdentityVerification struct {
	Method       string         `json:"method"`
	Verified     bool           `json:"verified"`
	VerifiedBy   string         `json:"verified_by"`
	VerifiedDate time.Time      `json:"verified_date"`
	Evidence     []string       `json:"evidence"`
	Metadata     map[string]any `json:"metadata"`
}

IdentityVerification represents identity verification for data subject requests

type InMemoryAuditStorage

type InMemoryAuditStorage struct {
	// contains filtered or unexported fields
}

InMemoryAuditStorage implements AuditStorage for testing and development

func NewInMemoryAuditStorage

func NewInMemoryAuditStorage() *InMemoryAuditStorage

NewInMemoryAuditStorage creates a new in-memory audit storage

func (*InMemoryAuditStorage) BatchStore

func (imas *InMemoryAuditStorage) BatchStore(ctx context.Context, entries []AuditLogEntry) error

BatchStore stores multiple audit entries

func (*InMemoryAuditStorage) Clear

func (imas *InMemoryAuditStorage) Clear()

Clear clears all audit entries

func (*InMemoryAuditStorage) Query

func (imas *InMemoryAuditStorage) Query(ctx context.Context, filter AuditFilter) ([]AuditLogEntry, error)

Query queries audit entries based on filter

func (*InMemoryAuditStorage) Store

func (imas *InMemoryAuditStorage) Store(ctx context.Context, entry AuditLogEntry) error

Store stores a single audit entry

type IncidentForecast

type IncidentForecast struct {
	Type          string         `json:"type"`
	Probability   float64        `json:"probability"`
	Severity      string         `json:"severity"`
	EstimatedTime time.Time      `json:"estimated_time"`
	Confidence    float64        `json:"confidence"`
	Indicators    []string       `json:"indicators"`
	Prevention    []string       `json:"prevention"`
	Impact        IncidentImpact `json:"impact"`
	Metadata      map[string]any `json:"metadata"`
}

IncidentForecast represents a forecasted incident

type IncidentImpact

type IncidentImpact struct {
	Financial    float64       `json:"financial"`
	Operational  string        `json:"operational"`
	Reputational string        `json:"reputational"`
	Compliance   string        `json:"compliance"`
	Recovery     time.Duration `json:"recovery"`
}

IncidentImpact represents the impact of an incident

type IncidentRecord

type IncidentRecord struct {
	Timestamp  time.Time `json:"timestamp"`
	Type       string    `json:"type"`
	Severity   string    `json:"severity"`
	Impact     string    `json:"impact"`
	Resolved   bool      `json:"resolved"`
	Resolution string    `json:"resolution"`
}

IncidentRecord represents an incident record

type IncidentResponseData

type IncidentResponseData struct {
	IncidentID       string    `json:"incident_id"`
	IncidentType     string    `json:"incident_type"`
	Severity         string    `json:"severity"`
	DetectionTime    time.Time `json:"detection_time"`
	ResponseTime     time.Time `json:"response_time"`
	ContainmentTime  time.Time `json:"containment_time"`
	ResolutionTime   time.Time `json:"resolution_time"`
	NotificationSent bool      `json:"notification_sent"`
	LessonsLearned   string    `json:"lessons_learned"`
}

IncidentResponseData for incident response controls

type IndustryComplianceReport

type IndustryComplianceReport struct {
	Industry            string                     `json:"industry"`
	Regulations         []RegulationCompliance     `json:"regulations"`
	OverallScore        float64                    `json:"overall_score"`
	ComplianceStatus    string                     `json:"compliance_status"`
	CriticalFindings    []ComplianceFinding        `json:"critical_findings"`
	Recommendations     []ComplianceRecommendation `json:"recommendations"`
	NextAuditDate       time.Time                  `json:"next_audit_date"`
	CertificationStatus []CertificationStatus      `json:"certification_status"`
	RiskAssessment      *IndustryRiskAssessment    `json:"risk_assessment"`
	GeneratedAt         time.Time                  `json:"generated_at"`
}

IndustryComplianceReport represents an industry-specific compliance report

type IndustryComplianceTemplate

type IndustryComplianceTemplate interface {
	GetIndustry() string
	GetRegulations() []string
	GetControls() []ComplianceControl
	GetAudits() []AuditRequirement
	GetRiskAssessments() []RiskAssessmentTemplate
	GetComplianceMiddleware() []LiftMiddleware
	ValidateCompliance(ctx LiftContext) (*ComplianceResult, error)
	GenerateComplianceReport() (*IndustryComplianceReport, error)
}

IndustryComplianceTemplate interface for industry-specific compliance

type IndustryComplianceTemplateManager

type IndustryComplianceTemplateManager struct {
	// contains filtered or unexported fields
}

IndustryComplianceTemplateManager manages industry-specific compliance templates

func NewIndustryComplianceTemplateManager

func NewIndustryComplianceTemplateManager() *IndustryComplianceTemplateManager

NewIndustryComplianceTemplateManager creates a new template manager

func (*IndustryComplianceTemplateManager) GetAvailableIndustries

func (ictm *IndustryComplianceTemplateManager) GetAvailableIndustries() []string

GetAvailableIndustries returns available industry templates

func (*IndustryComplianceTemplateManager) GetTemplate

GetTemplate retrieves an industry compliance template

func (*IndustryComplianceTemplateManager) RegisterTemplate

func (ictm *IndustryComplianceTemplateManager) RegisterTemplate(industry string, template IndustryComplianceTemplate)

RegisterTemplate registers an industry compliance template

type IndustryRiskAssessment

type IndustryRiskAssessment struct {
	Industry        string               `json:"industry"`
	RiskLevel       string               `json:"risk_level"`
	RiskScore       float64              `json:"risk_score"`
	RiskFactors     []IndustryRiskFactor `json:"risk_factors"`
	ThreatLandscape []ThreatVector       `json:"threat_landscape"`
	Vulnerabilities []Vulnerability      `json:"vulnerabilities"`
	Mitigations     []RiskMitigation     `json:"mitigations"`
	ResidualRisk    float64              `json:"residual_risk"`
	AssessmentDate  time.Time            `json:"assessment_date"`
	NextAssessment  time.Time            `json:"next_assessment"`
}

IndustryRiskAssessment represents industry-specific risk assessment

type IndustryRiskFactor

type IndustryRiskFactor struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Category    string  `json:"category"`
	Description string  `json:"description"`
	Impact      string  `json:"impact"`
	Likelihood  string  `json:"likelihood"`
	Score       float64 `json:"score"`
	Trend       string  `json:"trend"`
	Mitigation  string  `json:"mitigation"`
}

IndustryRiskFactor represents an industry-specific risk factor

type IndustryTemplate

type IndustryTemplate struct {
	Industry    string              `json:"industry"` // "banking", "healthcare", "retail", "government"
	Regulations []string            `json:"regulations"`
	Controls    []ComplianceControl `json:"controls"`
	Audits      []AuditRequirement  `json:"audits"`
	Metadata    map[string]any      `json:"metadata"`
}

IndustryTemplate for industry-specific compliance

type JWTConfig

type JWTConfig struct {
	// Signing configuration
	SigningMethod  string `json:"signing_method"` // RS256, HS256
	PublicKeyPath  string `json:"public_key_path"`
	PrivateKeyPath string `json:"private_key_path"`
	SecretKey      string `json:"secret_key,omitempty"` // For HS256

	// Validation settings
	Issuer   string        `json:"issuer"`
	Audience []string      `json:"audience"`
	MaxAge   time.Duration `json:"max_age"`

	// Multi-tenant settings
	RequireTenantID bool                        `json:"require_tenant_id"`
	ValidateTenant  func(tenantID string) error `json:"-"` // Custom validation function

	// Key rotation
	KeyRotation    bool          `json:"key_rotation"`
	RotationPeriod time.Duration `json:"rotation_period"`
}

JWTConfig configures JWT authentication

type LiftContext

type LiftContext interface {
	Set(key string, value any)
	Get(key string) any
	UserID() string
	TenantID() string
	ClientIP() string
	Logger() Logger
	GetDataAccessLog() []string
}

LiftContext represents the minimal interface needed from lift.Context

type LiftHandler

type LiftHandler interface {
	Handle(ctx LiftContext) error
}

LiftHandler represents a handler function

type LiftHandlerFunc

type LiftHandlerFunc func(ctx LiftContext) error

LiftHandlerFunc is an adapter to allow ordinary functions to be used as handlers

func (LiftHandlerFunc) Handle

func (f LiftHandlerFunc) Handle(ctx LiftContext) error

Handle calls f(ctx)

type LiftMiddleware

type LiftMiddleware func(next LiftHandler) LiftHandler

LiftMiddleware represents middleware that wraps handlers

func DataProtection

func DataProtection(config DataProtectionConfig) LiftMiddleware

DataProtection creates middleware for data protection

type Logger

type Logger interface {
	Error(msg string, keysAndValues ...any)
	Info(msg string, keysAndValues ...any)
	Warn(msg string, keysAndValues ...any)
}

Logger represents the minimal logging interface needed

type MLRiskScorer

type MLRiskScorer struct {
	// contains filtered or unexported fields
}

MLRiskScorer implements ML-based risk scoring

func NewMLRiskScorer

func NewMLRiskScorer(config RiskScoringConfig) *MLRiskScorer

NewMLRiskScorer creates a new ML-based risk scorer

func (*MLRiskScorer) CalculateAggregateRisk

func (mrs *MLRiskScorer) CalculateAggregateRisk(ctx context.Context, events []*AuditEvent) (*AggregateRiskScore, error)

CalculateAggregateRisk calculates aggregate risk for multiple events

func (*MLRiskScorer) CalculateRiskScore

func (mrs *MLRiskScorer) CalculateRiskScore(ctx context.Context, event *AuditEvent) (*RiskScore, error)

CalculateRiskScore calculates risk score for an audit event

func (*MLRiskScorer) GetRiskFactors

func (mrs *MLRiskScorer) GetRiskFactors() []RiskFactor

GetRiskFactors returns the current risk factors

func (*MLRiskScorer) SetModel

func (mrs *MLRiskScorer) SetModel(model RiskModel)

SetModel sets the risk model

func (*MLRiskScorer) UpdateRiskModel

func (mrs *MLRiskScorer) UpdateRiskModel(ctx context.Context, feedback []*RiskFeedback) error

UpdateRiskModel updates the risk model with feedback

type MaskingRule

type MaskingRule struct {
	Type        string `json:"type"`        // "partial", "full", "hash", "tokenize"
	Pattern     string `json:"pattern"`     // regex pattern for partial masking
	Replacement string `json:"replacement"` // replacement character/string
}

MaskingRule defines how to mask sensitive data

type MetricResult

type MetricResult struct {
	Timestamp time.Time          `json:"timestamp"`
	Values    map[string]float64 `json:"values"`
	Labels    map[string]string  `json:"labels"`
	Metadata  map[string]any     `json:"metadata"`
}

MetricResult represents a metric result

type MetricSummary

type MetricSummary struct {
	TotalDataPoints int                `json:"total_data_points"`
	TimeRange       TimeRange          `json:"time_range"`
	Aggregations    map[string]float64 `json:"aggregations"`
	Trends          map[string]string  `json:"trends"`
}

MetricSummary represents a summary of metrics

type MetricsEngine

type MetricsEngine interface {
	CalculateComplianceMetrics(ctx context.Context, timeRange TimeRange) (*ComplianceMetrics, error)
	CalculateRiskMetrics(ctx context.Context, timeRange TimeRange) (*RiskMetrics, error)
	CalculateAuditMetrics(ctx context.Context, timeRange TimeRange) (*AuditMetrics, error)
	CalculatePerformanceMetrics(ctx context.Context, timeRange TimeRange) (*PerformanceMetrics, error)
	CalculateCustomMetrics(ctx context.Context, queries []CustomMetricQuery) ([]*CustomMetric, error)
}

MetricsEngine interface for metrics calculation

type MetricsQuery

type MetricsQuery struct {
	AnalyticsQuery
	Aggregation string        `json:"aggregation"` // "sum", "avg", "min", "max", "count"
	GroupBy     []string      `json:"group_by"`
	Interval    time.Duration `json:"interval"`
}

MetricsQuery represents a query for aggregated metrics

type MitigationMeasure

type MitigationMeasure struct {
	ID             string    `json:"id"`
	Type           string    `json:"type"`
	Description    string    `json:"description"`
	Implementation string    `json:"implementation"`
	Effectiveness  string    `json:"effectiveness"`
	Cost           string    `json:"cost"`
	Timeline       string    `json:"timeline"`
	Owner          string    `json:"owner"`
	Status         string    `json:"status"`
	ReviewDate     time.Time `json:"review_date"`
}

MitigationMeasure represents a mitigation measure

type MockConsentStoreFixed

type MockConsentStoreFixed struct {
	mock.Mock
}

MockConsentStore implements ConsentStore interface for testing

func (*MockConsentStoreFixed) CleanupExpiredConsents

func (m *MockConsentStoreFixed) CleanupExpiredConsents(ctx context.Context) error

func (*MockConsentStoreFixed) GetAllConsents

func (m *MockConsentStoreFixed) GetAllConsents(ctx context.Context, dataSubjectID string) ([]*ConsentRecord, error)

func (*MockConsentStoreFixed) GetConsent

func (m *MockConsentStoreFixed) GetConsent(ctx context.Context, dataSubjectID, purpose string) (*ConsentRecord, error)

func (*MockConsentStoreFixed) GetConsentHistory

func (m *MockConsentStoreFixed) GetConsentHistory(ctx context.Context, consentID string) ([]*ConsentHistoryEntry, error)

func (*MockConsentStoreFixed) GetConsentsForRenewal

func (m *MockConsentStoreFixed) GetConsentsForRenewal(ctx context.Context) ([]*ConsentRecord, error)

func (*MockConsentStoreFixed) GetExpiredConsents

func (m *MockConsentStoreFixed) GetExpiredConsents(ctx context.Context) ([]*ConsentRecord, error)

func (*MockConsentStoreFixed) ListConsents

func (m *MockConsentStoreFixed) ListConsents(ctx context.Context, dataSubjectID string) ([]*ConsentRecord, error)

func (*MockConsentStoreFixed) RecordConsent

func (m *MockConsentStoreFixed) RecordConsent(ctx context.Context, consent *ConsentRecord) error

func (*MockConsentStoreFixed) StoreConsent

func (m *MockConsentStoreFixed) StoreConsent(ctx context.Context, consent *ConsentRecord) error

func (*MockConsentStoreFixed) UpdateConsent

func (m *MockConsentStoreFixed) UpdateConsent(ctx context.Context, consentID string, updates *ConsentUpdates) error

func (*MockConsentStoreFixed) WithdrawConsent

func (m *MockConsentStoreFixed) WithdrawConsent(ctx context.Context, consentID string, withdrawal *ConsentWithdrawal) error

type MockSecretsProvider

type MockSecretsProvider struct {
	// contains filtered or unexported fields
}

MockSecretsProvider implements SecretsProvider for testing

func NewMockSecretsProvider

func NewMockSecretsProvider() *MockSecretsProvider

NewMockSecretsProvider creates a mock secrets provider for testing

func (*MockSecretsProvider) DeleteSecret

func (msp *MockSecretsProvider) DeleteSecret(ctx context.Context, name string) error

DeleteSecret removes a mock secret

func (*MockSecretsProvider) GetSecret

func (msp *MockSecretsProvider) GetSecret(ctx context.Context, name string) (string, error)

GetSecret retrieves a mock secret

func (*MockSecretsProvider) PutSecret

func (msp *MockSecretsProvider) PutSecret(ctx context.Context, name string, value string) error

PutSecret stores a mock secret

func (*MockSecretsProvider) RotateSecret

func (msp *MockSecretsProvider) RotateSecret(ctx context.Context, name string) error

RotateSecret simulates secret rotation

func (*MockSecretsProvider) SetSecret

func (msp *MockSecretsProvider) SetSecret(name, value string)

SetSecret is a convenience method for testing

type ModelMetrics

type ModelMetrics struct {
	Accuracy          float64            `json:"accuracy"`
	Precision         float64            `json:"precision"`
	Recall            float64            `json:"recall"`
	F1Score           float64            `json:"f1_score"`
	AUC               float64            `json:"auc"`
	RMSE              float64            `json:"rmse"`
	LastUpdated       time.Time          `json:"last_updated"`
	TrainingExamples  int                `json:"training_examples"`
	FeatureImportance map[string]float64 `json:"feature_importance"`
}

ModelMetrics represents metrics for the risk model

type MonitoringScheduler

type MonitoringScheduler struct {
	// contains filtered or unexported fields
}

MonitoringScheduler handles scheduling of monitoring tasks

func NewMonitoringScheduler

func NewMonitoringScheduler() *MonitoringScheduler

NewMonitoringScheduler creates a new monitoring scheduler

func (*MonitoringScheduler) AddTask

func (ms *MonitoringScheduler) AddTask(task *ScheduledTask)

AddTask adds a scheduled task

func (*MonitoringScheduler) Start

func (ms *MonitoringScheduler) Start(ctx context.Context) error

Start starts the scheduler

func (*MonitoringScheduler) Stop

func (ms *MonitoringScheduler) Stop() error

Stop stops the scheduler

type PIAFilters

type PIAFilters struct {
	RiskLevel       []string   `json:"risk_level,omitempty"`
	AssessmentType  []string   `json:"assessment_type,omitempty"`
	RequestedBy     []string   `json:"requested_by,omitempty"`
	DateFrom        *time.Time `json:"date_from,omitempty"`
	DateTo          *time.Time `json:"date_to,omitempty"`
	ApprovalStatus  []string   `json:"approval_status,omitempty"`
	ProcessingTypes []string   `json:"processing_types,omitempty"`
	Limit           int        `json:"limit,omitempty"`
	Offset          int        `json:"offset,omitempty"`
}

PIAFilters represents filters for PIA queries

type PIAFinding

type PIAFinding struct {
	ID          string   `json:"id"`
	Category    string   `json:"category"`
	Severity    string   `json:"severity"`
	Description string   `json:"description"`
	Impact      string   `json:"impact"`
	Likelihood  string   `json:"likelihood"`
	RiskScore   float64  `json:"risk_score"`
	Evidence    []string `json:"evidence"`
}

PIAFinding represents a finding from a privacy impact assessment

type PIAQuestion

type PIAQuestion struct {
	ID         string   `json:"id"`
	Category   string   `json:"category"`
	Question   string   `json:"question"`
	Type       string   `json:"type"` // "text", "boolean", "multiple_choice", "scale"
	Required   bool     `json:"required"`
	Options    []string `json:"options,omitempty"`
	Guidance   string   `json:"guidance"`
	RiskWeight float64  `json:"risk_weight"`
}

PIAQuestion represents a question in a PIA template

type PIARecommendation

type PIARecommendation struct {
	ID          string   `json:"id"`
	Priority    string   `json:"priority"`
	Description string   `json:"description"`
	Actions     []string `json:"actions"`
	Timeline    string   `json:"timeline"`
	Owner       string   `json:"owner"`
	Status      string   `json:"status"`
}

PIARecommendation represents a recommendation from a privacy impact assessment

type PIARequest

type PIARequest struct {
	ID                 string                  `json:"id"`
	ProcessingActivity *DataProcessingActivity `json:"processing_activity"`
	AssessmentType     string                  `json:"assessment_type"`
	Scope              []string                `json:"scope"`
	RequestedBy        string                  `json:"requested_by"`
	RequestDate        time.Time               `json:"request_date"`
	DueDate            time.Time               `json:"due_date"`
	Stakeholders       []string                `json:"stakeholders"`
	// Additional fields needed by tests
	ProjectName string         `json:"project_name,omitempty"`
	DataTypes   []string       `json:"data_types,omitempty"`
	Purpose     string         `json:"purpose,omitempty"`
	LegalBasis  string         `json:"legal_basis,omitempty"`
	Metadata    map[string]any `json:"metadata"`
}

PIARequest represents a privacy impact assessment request

type PIAResult

type PIAResult struct {
	AssessmentID       string              `json:"assessment_id"`
	CompletionDate     time.Time           `json:"completion_date"`
	RiskLevel          string              `json:"risk_level"`
	RiskScore          float64             `json:"risk_score"`
	Findings           []PIAFinding        `json:"findings"`
	Recommendations    []PIARecommendation `json:"recommendations"`
	MitigationMeasures []MitigationMeasure `json:"mitigation_measures"`
	ApprovalRequired   bool                `json:"approval_required"`
	ApprovedBy         string              `json:"approved_by,omitempty"`
	ApprovalDate       *time.Time          `json:"approval_date,omitempty"`
	ReviewDate         time.Time           `json:"review_date"`
	// Additional fields needed by tests
	ID        string         `json:"id,omitempty"`
	Status    string         `json:"status,omitempty"`
	Timestamp time.Time      `json:"timestamp,omitempty"`
	Metadata  map[string]any `json:"metadata"`
}

PIAResult represents the result of a privacy impact assessment

type PIARiskFactor

type PIARiskFactor struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Category    string  `json:"category"`
	Weight      float64 `json:"weight"`
	Threshold   float64 `json:"threshold"`
}

PIARiskFactor represents a risk factor in privacy assessment

type PIATemplate

type PIATemplate struct {
	ID               string          `json:"id"`
	Name             string          `json:"name"`
	ProcessingType   string          `json:"processing_type"`
	Questions        []PIAQuestion   `json:"questions"`
	RiskFactors      []PIARiskFactor `json:"risk_factors"`
	RequiredEvidence []string        `json:"required_evidence"`
	Metadata         map[string]any  `json:"metadata"`
}

PIATemplate represents a template for privacy impact assessments

type PIAUpdate

type PIAUpdate struct {
	RiskLevel          *string             `json:"risk_level,omitempty"`
	RiskScore          *float64            `json:"risk_score,omitempty"`
	Findings           []PIAFinding        `json:"findings,omitempty"`
	Recommendations    []PIARecommendation `json:"recommendations,omitempty"`
	MitigationMeasures []MitigationMeasure `json:"mitigation_measures,omitempty"`
	ApprovalRequired   *bool               `json:"approval_required,omitempty"`
	ApprovedBy         string              `json:"approved_by,omitempty"`
	ApprovalDate       *time.Time          `json:"approval_date,omitempty"`
	ReviewDate         *time.Time          `json:"review_date,omitempty"`
	UpdatedBy          string              `json:"updated_by"`
	UpdateReason       string              `json:"update_reason"`
	Metadata           map[string]any      `json:"metadata,omitempty"`
}

PIAUpdate represents updates to a Privacy Impact Assessment

type PerformanceMetrics

type PerformanceMetrics struct {
	AvgAnalysisTime   time.Duration `json:"avg_analysis_time"`
	MemoryUsage       int64         `json:"memory_usage"`
	Accuracy          float64       `json:"accuracy"`
	FalsePositiveRate float64       `json:"false_positive_rate"`
	Throughput        float64       `json:"throughput"`
}

PerformanceMetrics represents performance metrics

type PerformanceTargets

type PerformanceTargets struct {
	MaxAnalysisTime      time.Duration `json:"max_analysis_time"`
	MaxMemoryUsage       int64         `json:"max_memory_usage"`
	MinAccuracy          float64       `json:"min_accuracy"`
	MaxFalsePositiveRate float64       `json:"max_false_positive_rate"`
}

PerformanceTargets defines performance targets for analytics

type Permission

type Permission struct {
	Resource   string         `json:"resource"`   // "users", "payments", "accounts"
	Action     string         `json:"action"`     // "read", "write", "delete"
	Conditions map[string]any `json:"conditions"` // Dynamic conditions
}

Permission represents a specific permission in the RBAC system

type PredictionReport

type PredictionReport struct {
	Timeframe            time.Duration         `json:"timeframe"`
	GeneratedAt          time.Time             `json:"generated_at"`
	CompliancePrediction *CompliancePrediction `json:"compliance_prediction,omitempty"`
	TrendPredictions     []*TrendPrediction    `json:"trend_predictions,omitempty"`
	IncidentForecasts    []*IncidentForecast   `json:"incident_forecasts,omitempty"`
}

PredictionReport represents a prediction report

type PredictiveModel

type PredictiveModel interface {
	PredictComplianceRisk(ctx context.Context, timeframe time.Duration) (*CompliancePrediction, error)
	PredictTrends(ctx context.Context, metrics []string, timeframe time.Duration) ([]*TrendPrediction, error)
	ForecastIncidents(ctx context.Context, timeframe time.Duration) ([]*IncidentForecast, error)
	UpdateModel(ctx context.Context, historicalData []*AnalyticsDataPoint) error
}

PredictiveModel interface for predictive analytics

type PredictiveRiskFactor

type PredictiveRiskFactor struct {
	RiskFactor
	Trend           string        `json:"trend"`
	PredictedValue  float64       `json:"predicted_value"`
	PredictedImpact float64       `json:"predicted_impact"`
	Probability     float64       `json:"probability"`
	TimeToImpact    time.Duration `json:"time_to_impact"`
}

PredictiveRiskFactor represents a risk factor in predictions

type Principal

type Principal struct {
	// Identity
	UserID    string `json:"user_id"`
	TenantID  string `json:"tenant_id"`
	AccountID string `json:"account_id"` // Partner or Kernel account

	// Authorization
	Roles  []string `json:"roles"`
	Scopes []string `json:"scopes"`

	// Metadata
	AuthMethod string    `json:"auth_method"` // "jwt", "api_key", "cross_account"
	IssuedAt   time.Time `json:"issued_at"`
	ExpiresAt  time.Time `json:"expires_at"`

	// Request context
	IPAddress string `json:"ip_address"`
	UserAgent string `json:"user_agent"`

	// Internal tracking
	SessionID string `json:"session_id"`
	RequestID string `json:"request_id"`
}

Principal represents an authenticated entity (user, service, etc.) with their permissions

func AnonymousPrincipal

func AnonymousPrincipal() *Principal

AnonymousPrincipal creates a principal for unauthenticated requests

func ServicePrincipal

func ServicePrincipal(serviceID, tenantID string) *Principal

ServicePrincipal creates a principal for service-to-service communication

func SystemPrincipal

func SystemPrincipal() *Principal

SystemPrincipal creates a principal for system/internal operations

func (*Principal) CanAccessResource

func (p *Principal) CanAccessResource(resource, action string) bool

CanAccessResource checks if the principal can access a specific resource

func (*Principal) HasAllRoles

func (p *Principal) HasAllRoles(roles ...string) bool

HasAllRoles checks if the principal has all of the specified roles

func (*Principal) HasAnyRole

func (p *Principal) HasAnyRole(roles ...string) bool

HasAnyRole checks if the principal has any of the specified roles

func (*Principal) HasRole

func (p *Principal) HasRole(role string) bool

HasRole checks if the principal has a specific role

func (*Principal) HasScope

func (p *Principal) HasScope(scope string) bool

HasScope checks if the principal has a specific scope

func (*Principal) IsExpired

func (p *Principal) IsExpired() bool

IsExpired checks if the principal's authentication has expired

func (*Principal) IsSameTenant

func (p *Principal) IsSameTenant(tenantID string) bool

IsSameTenant checks if the principal belongs to the specified tenant

func (*Principal) IsValidForTenant

func (p *Principal) IsValidForTenant(tenantID string) bool

IsValidForTenant checks if the principal is valid for operations on the specified tenant

func (*Principal) ToAuditMap

func (p *Principal) ToAuditMap() map[string]any

ToAuditMap converts the principal to a map for audit logging

type PrincipalBuilder

type PrincipalBuilder struct {
	// contains filtered or unexported fields
}

PrincipalBuilder provides a fluent interface for building principals

func NewPrincipalBuilder

func NewPrincipalBuilder() *PrincipalBuilder

NewPrincipalBuilder creates a new principal builder

func (*PrincipalBuilder) AddRole

func (b *PrincipalBuilder) AddRole(role string) *PrincipalBuilder

AddRole adds a single role

func (*PrincipalBuilder) AddScope

func (b *PrincipalBuilder) AddScope(scope string) *PrincipalBuilder

AddScope adds a single scope

func (*PrincipalBuilder) Build

func (b *PrincipalBuilder) Build() *Principal

Build returns the constructed principal

func (*PrincipalBuilder) Validate

func (b *PrincipalBuilder) Validate() error

Validate validates the principal

func (*PrincipalBuilder) WithAccountID

func (b *PrincipalBuilder) WithAccountID(accountID string) *PrincipalBuilder

WithAccountID sets the account ID

func (*PrincipalBuilder) WithAuthMethod

func (b *PrincipalBuilder) WithAuthMethod(method string) *PrincipalBuilder

WithAuthMethod sets the authentication method

func (*PrincipalBuilder) WithExpiration

func (b *PrincipalBuilder) WithExpiration(duration time.Duration) *PrincipalBuilder

WithExpiration sets the expiration time

func (*PrincipalBuilder) WithRequest

func (b *PrincipalBuilder) WithRequest(ipAddress, userAgent, requestID string) *PrincipalBuilder

WithRequest sets request-specific information

func (*PrincipalBuilder) WithRoles

func (b *PrincipalBuilder) WithRoles(roles ...string) *PrincipalBuilder

WithRoles sets the roles

func (*PrincipalBuilder) WithScopes

func (b *PrincipalBuilder) WithScopes(scopes ...string) *PrincipalBuilder

WithScopes sets the scopes

func (*PrincipalBuilder) WithTenantID

func (b *PrincipalBuilder) WithTenantID(tenantID string) *PrincipalBuilder

WithTenantID sets the tenant ID

func (*PrincipalBuilder) WithUserID

func (b *PrincipalBuilder) WithUserID(userID string) *PrincipalBuilder

WithUserID sets the user ID

type PrivacyBreachLog

type PrivacyBreachLog struct {
	BreachID          string         `json:"breach_id"`
	BreachType        string         `json:"breach_type"`
	Severity          string         `json:"severity"`
	DetectedDate      time.Time      `json:"detected_date"`
	ReportedDate      time.Time      `json:"reported_date"`
	AffectedSubjects  int            `json:"affected_subjects"`
	DataCategories    []string       `json:"data_categories"`
	Cause             string         `json:"cause"`
	Mitigation        []string       `json:"mitigation"`
	AuthorityNotified bool           `json:"authority_notified"`
	SubjectsNotified  bool           `json:"subjects_notified"`
	Metadata          map[string]any `json:"metadata"`
}

PrivacyBreachLog represents a privacy breach for audit logging

type PrivacyImpactAssessment

type PrivacyImpactAssessment interface {
	ConductPIA(ctx context.Context, assessment *PIARequest) (*PIAResult, error)
	GetPIATemplate(processingType string) (*PIATemplate, error)
	ValidateDataProcessing(ctx context.Context, processing *DataProcessingActivity) (*ProcessingValidation, error)
	GetRiskAssessment(ctx context.Context, activityID string) (*RiskAssessment, error)
	// Additional methods needed by tests
	UpdatePIA(ctx context.Context, piaID string, updates *PIAUpdate) error
	GetPIA(ctx context.Context, piaID string) (*PIAResult, error)
	ListPIAs(ctx context.Context, filters *PIAFilters) ([]*PIAResult, error)
}

PrivacyImpactAssessment interface for privacy impact assessments

type ProcessingValidation

type ProcessingValidation struct {
	Valid           bool              `json:"valid"`
	ValidationDate  time.Time         `json:"validation_date"`
	Issues          []ValidationIssue `json:"issues"`
	Recommendations []string          `json:"recommendations"`
	ComplianceScore float64           `json:"compliance_score"`
	RequiredActions []string          `json:"required_actions"`
	Metadata        map[string]any    `json:"metadata"`
}

ProcessingValidation represents validation of data processing activity

type RateLimitConfig

type RateLimitConfig struct {
	// Global limits
	GlobalEnabled bool          `json:"global_enabled"`
	GlobalLimit   int           `json:"global_limit"`
	GlobalPeriod  time.Duration `json:"global_period"`

	// Per-tenant limits
	TenantEnabled bool          `json:"tenant_enabled"`
	TenantLimit   int           `json:"tenant_limit"`
	TenantPeriod  time.Duration `json:"tenant_period"`

	// Per-user limits
	UserEnabled bool          `json:"user_enabled"`
	UserLimit   int           `json:"user_limit"`
	UserPeriod  time.Duration `json:"user_period"`

	// Storage backend for rate limiting
	StorageType   string         `json:"storage_type"` // "memory", "redis", "dynamodb"
	StorageConfig map[string]any `json:"storage_config"`
}

RateLimitConfig defines rate limiting configuration

type RegulationCompliance

type RegulationCompliance struct {
	Regulation          string              `json:"regulation"`
	Status              string              `json:"status"`
	Score               float64             `json:"score"`
	RequiredControls    int                 `json:"required_controls"`
	ImplementedControls int                 `json:"implemented_controls"`
	Findings            []ComplianceFinding `json:"findings"`
	LastAssessment      time.Time           `json:"last_assessment"`
	NextAssessment      time.Time           `json:"next_assessment"`
	Metadata            map[string]any      `json:"metadata"`
}

RegulationCompliance represents compliance with a specific regulation

type RemediationEngine

type RemediationEngine interface {
	GenerateRemediation(ctx context.Context, issue *ComplianceIssue) (*RemediationPlan, error)
	ExecuteRemediation(ctx context.Context, plan *RemediationPlan) (*RemediationResult, error)
	GetRemediationTemplates() []RemediationTemplate
	ValidateRemediation(ctx context.Context, result *RemediationResult) (*ValidationResult, error)
}

RemediationEngine interface for automated remediation

type RemediationPlan

type RemediationPlan struct {
	ID             string            `json:"id"`
	IssueID        string            `json:"issue_id"`
	Type           string            `json:"type"`
	Priority       string            `json:"priority"`
	Description    string            `json:"description"`
	Steps          []RemediationStep `json:"steps"`
	EstimatedTime  time.Duration     `json:"estimated_time"`
	EstimatedCost  float64           `json:"estimated_cost"`
	RequiredSkills []string          `json:"required_skills"`
	Dependencies   []string          `json:"dependencies"`
	RiskReduction  float64           `json:"risk_reduction"`
	SuccessMetrics []string          `json:"success_metrics"`
	Rollback       *RollbackPlan     `json:"rollback,omitempty"`
	CreatedAt      time.Time         `json:"created_at"`
	Metadata       map[string]any    `json:"metadata"`
}

RemediationPlan represents a plan for remediation

type RemediationResult

type RemediationResult struct {
	PlanID        string             `json:"plan_id"`
	Status        string             `json:"status"`
	StartTime     time.Time          `json:"start_time"`
	EndTime       time.Time          `json:"end_time"`
	Duration      time.Duration      `json:"duration"`
	StepsExecuted []StepResult       `json:"steps_executed"`
	Success       bool               `json:"success"`
	RiskReduction float64            `json:"risk_reduction"`
	Issues        []string           `json:"issues"`
	Metrics       map[string]float64 `json:"metrics"`
	Metadata      map[string]any     `json:"metadata"`
}

RemediationResult represents the result of remediation

type RemediationStep

type RemediationStep struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Type        string         `json:"type"` // "manual", "automated", "approval"
	Order       int            `json:"order"`
	Duration    time.Duration  `json:"duration"`
	Automated   bool           `json:"automated"`
	Command     string         `json:"command,omitempty"`
	Parameters  map[string]any `json:"parameters,omitempty"`
	Validation  string         `json:"validation"`
	Rollback    string         `json:"rollback"`
}

RemediationStep represents a step in remediation

type RemediationTemplate

type RemediationTemplate struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Type        string            `json:"type"`
	Description string            `json:"description"`
	Frameworks  []string          `json:"frameworks"`
	IssueTypes  []string          `json:"issue_types"`
	Steps       []RemediationStep `json:"steps"`
	Metadata    map[string]any    `json:"metadata"`
}

RemediationTemplate represents a template for remediation

type Request

type Request interface {
	Method() string
	Path() string
	Header(key string) string
	UserAgent() string
	ContentLength() int64
	URL() URL
}

Request represents the minimal request interface needed

type RequestStatus

type RequestStatus struct {
	RequestID   string    `json:"request_id"`
	Status      string    `json:"status"`
	LastUpdated time.Time `json:"last_updated"`
	DueDate     time.Time `json:"due_date"`
	Progress    int       `json:"progress"` // percentage
	NextAction  string    `json:"next_action"`
	AssignedTo  string    `json:"assigned_to"`
	Notes       []string  `json:"notes"`
}

RequestStatus represents the status of a data subject request

type RequestValidationConfig

type RequestValidationConfig struct {
	// Size limits
	MaxBodySize   int64 `json:"max_body_size"`
	MaxHeaderSize int   `json:"max_header_size"`

	// Content validation
	AllowedMethods []string `json:"allowed_methods"`
	AllowedHeaders []string `json:"allowed_headers"`

	// Security validation
	ValidateJSON  bool `json:"validate_json"`
	SanitizeInput bool `json:"sanitize_input"`

	// IP filtering
	EnableIPFilter bool     `json:"enable_ip_filter"`
	AllowedCIDRs   []string `json:"allowed_cidrs"`
	DeniedCIDRs    []string `json:"denied_cidrs"`
}

RequestValidationConfig defines request validation settings

type Response

type Response interface {
	StatusCode() int
	Body() []byte
}

Response represents the minimal response interface needed

type RiskAssessment

type RiskAssessment struct {
	ID             string               `json:"id"`
	ActivityID     string               `json:"activity_id"`
	AssessmentDate time.Time            `json:"assessment_date"`
	RiskLevel      string               `json:"risk_level"`
	RiskScore      float64              `json:"risk_score"`
	RiskFactors    []AssessedRiskFactor `json:"risk_factors"`
	Mitigations    []MitigationMeasure  `json:"mitigations"`
	ResidualRisk   float64              `json:"residual_risk"`
	Approved       bool                 `json:"approved"`
	ApprovedBy     string               `json:"approved_by,omitempty"`
	ReviewDate     time.Time            `json:"review_date"`
	Metadata       map[string]any       `json:"metadata"`
}

RiskAssessment represents a risk assessment

type RiskAssessmentData

type RiskAssessmentData struct {
	AssessmentID    string    `json:"assessment_id"`
	AssessmentDate  time.Time `json:"assessment_date"`
	RiskLevel       string    `json:"risk_level"`
	RiskCategory    string    `json:"risk_category"`
	ThreatSources   []string  `json:"threat_sources"`
	Vulnerabilities []string  `json:"vulnerabilities"`
	Impact          string    `json:"impact"`
	Likelihood      string    `json:"likelihood"`
	MitigationPlan  string    `json:"mitigation_plan"`
	ResidualRisk    string    `json:"residual_risk"`
}

RiskAssessmentData for risk assessment controls

type RiskAssessmentTemplate

type RiskAssessmentTemplate struct {
	ID               string         `json:"id"`
	Name             string         `json:"name"`
	Industry         string         `json:"industry"`
	Scope            []string       `json:"scope"`
	RiskFactors      []RiskFactor   `json:"risk_factors"`
	ThreatSources    []string       `json:"threat_sources"`
	AssetCategories  []string       `json:"asset_categories"`
	ImpactCategories []string       `json:"impact_categories"`
	Methodology      string         `json:"methodology"`
	Frequency        time.Duration  `json:"frequency"`
	Metadata         map[string]any `json:"metadata"`
}

RiskAssessmentTemplate represents a risk assessment template

type RiskBaseline

type RiskBaseline struct {
	AverageRisk      float64            `json:"average_risk"`
	RiskDistribution map[string]float64 `json:"risk_distribution"`
	FactorBaselines  map[string]float64 `json:"factor_baselines"`
	TemporalPatterns map[string]float64 `json:"temporal_patterns"`
	UpdatedAt        time.Time          `json:"updated_at"`
	SampleSize       int                `json:"sample_size"`
	Metadata         map[string]any     `json:"metadata"`
}

RiskBaseline represents baseline risk metrics

type RiskContext

type RiskContext struct {
	UserHistory   []*AuditEvent       `json:"user_history"`
	TenantHistory []*AuditEvent       `json:"tenant_history"`
	RecentEvents  []*AuditEvent       `json:"recent_events"`
	TimeOfDay     time.Time           `json:"time_of_day"`
	DayOfWeek     time.Weekday        `json:"day_of_week"`
	UserProfile   *UserRiskProfile    `json:"user_profile"`
	TenantProfile *TenantRiskProfile  `json:"tenant_profile"`
	ThreatIntel   *ThreatIntelligence `json:"threat_intel"`
	Metadata      map[string]any      `json:"metadata"`
}

RiskContext provides context for risk assessment

type RiskDataPoint

type RiskDataPoint struct {
	Timestamp     time.Time      `json:"timestamp"`
	RiskScore     float64        `json:"risk_score"`
	IncidentCount int            `json:"incident_count"`
	ThreatLevel   string         `json:"threat_level"`
	Metadata      map[string]any `json:"metadata"`
}

RiskDataPoint represents a risk data point

type RiskFactor

type RiskFactor struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Category    string  `json:"category"`
	Weight      float64 `json:"weight"`
	Value       float64 `json:"value"`
	Impact      float64 `json:"impact"`
	Description string  `json:"description"`
	Mitigation  string  `json:"mitigation"`
}

RiskFactor represents a factor contributing to risk

type RiskFeatureExtractor

type RiskFeatureExtractor struct {
	// contains filtered or unexported fields
}

RiskFeatureExtractor extracts features from audit events

type RiskFeedback

type RiskFeedback struct {
	EventID       string    `json:"event_id"`
	ActualRisk    float64   `json:"actual_risk"`
	PredictedRisk float64   `json:"predicted_risk"`
	Accuracy      float64   `json:"accuracy"`
	FeedbackType  string    `json:"feedback_type"`
	Comments      string    `json:"comments"`
	ProvidedBy    string    `json:"provided_by"`
	Timestamp     time.Time `json:"timestamp"`
}

RiskFeedback represents feedback for risk model improvement

type RiskMetrics

type RiskMetrics struct {
	OverallRiskScore    float64            `json:"overall_risk_score"`
	RiskLevel           string             `json:"risk_level"`
	RiskDistribution    map[string]int     `json:"risk_distribution"`
	TopRiskFactors      []RiskFactor       `json:"top_risk_factors"`
	RiskTrend           string             `json:"risk_trend"`
	IncidentCount       int                `json:"incident_count"`
	IncidentsByType     map[string]int     `json:"incidents_by_type"`
	IncidentsBySeverity map[string]int     `json:"incidents_by_severity"`
	ThreatLevel         string             `json:"threat_level"`
	VulnerabilityCount  int                `json:"vulnerability_count"`
	MitigationProgress  map[string]float64 `json:"mitigation_progress"`
	RiskAppetite        float64            `json:"risk_appetite"`
	RiskTolerance       float64            `json:"risk_tolerance"`
	HistoricalData      []RiskDataPoint    `json:"historical_data"`
}

RiskMetrics represents risk-specific metrics

type RiskMitigation

type RiskMitigation struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	Type          string    `json:"type"`
	Description   string    `json:"description"`
	Effectiveness string    `json:"effectiveness"`
	Cost          string    `json:"cost"`
	Timeline      string    `json:"timeline"`
	Owner         string    `json:"owner"`
	Status        string    `json:"status"`
	DueDate       time.Time `json:"due_date"`
}

RiskMitigation represents a risk mitigation

type RiskModel

type RiskModel interface {
	Predict(features []float64) (float64, error)
	Train(trainingData []TrainingExample) error
	Update(feedback []RiskFeedback) error
	GetFeatureImportance() map[string]float64
	GetModelMetrics() *ModelMetrics
}

RiskModel interface for different risk models

type RiskScenario

type RiskScenario struct {
	ID          string        `json:"id"`
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Probability float64       `json:"probability"`
	Impact      float64       `json:"impact"`
	RiskScore   float64       `json:"risk_score"`
	Mitigation  []string      `json:"mitigation"`
	Timeline    time.Duration `json:"timeline"`
}

RiskScenario represents a risk scenario

type RiskScore

type RiskScore struct {
	Score           float64        `json:"score"`
	Level           string         `json:"level"` // "low", "medium", "high", "critical"
	Confidence      float64        `json:"confidence"`
	Factors         []RiskFactor   `json:"factors"`
	Recommendations []string       `json:"recommendations"`
	Timestamp       time.Time      `json:"timestamp"`
	Metadata        map[string]any `json:"metadata"`
}

RiskScore represents a calculated risk score

type RiskScorer

type RiskScorer interface {
	CalculateRiskScore(ctx context.Context, event *AuditEvent) (*RiskScore, error)
	CalculateAggregateRisk(ctx context.Context, events []*AuditEvent) (*AggregateRiskScore, error)
	UpdateRiskModel(ctx context.Context, feedback []*RiskFeedback) error
	GetRiskFactors() []RiskFactor
}

RiskScorer interface for risk scoring algorithms

type RiskScoringConfig

type RiskScoringConfig struct {
	Enabled            bool                `json:"enabled"`
	ModelType          string              `json:"model_type"` // "linear", "neural", "ensemble"
	LearningRate       float64             `json:"learning_rate"`
	AdaptiveLearning   bool                `json:"adaptive_learning"`
	FeedbackWeight     float64             `json:"feedback_weight"`
	BaselineUpdateFreq time.Duration       `json:"baseline_update_freq"`
	RiskFactorWeights  map[string]float64  `json:"risk_factor_weights"`
	ThresholdConfig    RiskThresholdConfig `json:"threshold_config"`
	ContextualFactors  []string            `json:"contextual_factors"`
	TemporalFactors    []string            `json:"temporal_factors"`
	BehavioralFactors  []string            `json:"behavioral_factors"`
}

RiskScoringConfig configuration for risk scoring

type RiskThresholdConfig

type RiskThresholdConfig struct {
	CriticalThreshold float64 `json:"critical_threshold"`
	HighThreshold     float64 `json:"high_threshold"`
	MediumThreshold   float64 `json:"medium_threshold"`
	LowThreshold      float64 `json:"low_threshold"`
}

RiskThresholdConfig defines risk level thresholds

type Role

type Role struct {
	Name        string       `json:"name"`
	Description string       `json:"description"`
	Permissions []Permission `json:"permissions"`
	TenantID    string       `json:"tenant_id"` // Empty for global roles
}

Role represents a collection of permissions

type RollbackPlan

type RollbackPlan struct {
	Steps      []RemediationStep `json:"steps"`
	Triggers   []string          `json:"triggers"`
	MaxTime    time.Duration     `json:"max_time"`
	Validation []string          `json:"validation"`
}

RollbackPlan represents a rollback plan

type RotationRecord

type RotationRecord struct {
	Timestamp  time.Time `json:"timestamp"`
	OldValue   string    `json:"old_value,omitempty"` // For testing only
	NewValue   string    `json:"new_value,omitempty"` // For testing only
	RotationID string    `json:"rotation_id"`
	Method     string    `json:"method"`
	Success    bool      `json:"success"`
	Error      string    `json:"error,omitempty"`
}

RotationRecord tracks rotation events for testing

type SCCResult

type SCCResult struct {
	Valid             bool              `json:"valid"`
	ValidationDate    time.Time         `json:"validation_date"`
	ClausesApplicable bool              `json:"clauses_applicable"`
	Issues            []ValidationIssue `json:"issues"`
	Recommendations   []string          `json:"recommendations"`
	Metadata          map[string]any    `json:"metadata"`
}

SCCResult represents the result of SCC validation

type SCCValidation

type SCCValidation struct {
	ClausesVersion string         `json:"clauses_version"`
	DataExporter   string         `json:"data_exporter"`
	DataImporter   string         `json:"data_importer"`
	DataCategories []string       `json:"data_categories"`
	Purposes       []string       `json:"purposes"`
	Metadata       map[string]any `json:"metadata"`
}

SCCValidation represents Standard Contractual Clauses validation

type SOC2ComplianceStatus

type SOC2ComplianceStatus struct {
	Timestamp         time.Time            `json:"timestamp"`
	TotalControls     int                  `json:"total_controls"`
	EffectiveControls int                  `json:"effective_controls"`
	ComplianceRate    float64              `json:"compliance_rate"`
	ControlResults    []*ControlTestResult `json:"control_results"`
	ExceptionTrends   *ExceptionTrends     `json:"exception_trends"`
	Recommendations   []string             `json:"recommendations"`
}

SOC2ComplianceStatus represents the overall SOC 2 compliance status

type SOC2ContinuousMonitor

type SOC2ContinuousMonitor struct {
	// contains filtered or unexported fields
}

SOC2ContinuousMonitor provides continuous monitoring for SOC 2 Type II compliance

func NewSOC2ContinuousMonitor

func NewSOC2ContinuousMonitor(config SOC2MonitoringConfig) *SOC2ContinuousMonitor

NewSOC2ContinuousMonitor creates a new SOC 2 continuous monitor

func (*SOC2ContinuousMonitor) GetComplianceStatus

func (scm *SOC2ContinuousMonitor) GetComplianceStatus(ctx context.Context) (*SOC2ComplianceStatus, error)

GetComplianceStatus returns the current compliance status

func (*SOC2ContinuousMonitor) SetAlertManager

func (scm *SOC2ContinuousMonitor) SetAlertManager(manager AlertManager)

SetAlertManager sets the alert manager

func (*SOC2ContinuousMonitor) SetControlTester

func (scm *SOC2ContinuousMonitor) SetControlTester(tester ControlTester)

SetControlTester sets the control tester

func (*SOC2ContinuousMonitor) SetEvidenceCollector

func (scm *SOC2ContinuousMonitor) SetEvidenceCollector(collector EvidenceCollector)

SetEvidenceCollector sets the evidence collector

func (*SOC2ContinuousMonitor) SetExceptionTracker

func (scm *SOC2ContinuousMonitor) SetExceptionTracker(tracker ExceptionTracker)

SetExceptionTracker sets the exception tracker

func (*SOC2ContinuousMonitor) Start

func (scm *SOC2ContinuousMonitor) Start(ctx context.Context) error

Start starts the continuous monitoring

func (*SOC2ContinuousMonitor) Stop

func (scm *SOC2ContinuousMonitor) Stop() error

Stop stops the continuous monitoring

type SOC2Control

type SOC2Control struct {
	ID               string          `json:"id"`
	Name             string          `json:"name"`
	Description      string          `json:"description"`
	Category         string          `json:"category"` // "CC1", "CC2", etc.
	Type             string          `json:"type"`     // "preventive", "detective", "corrective"
	Frequency        time.Duration   `json:"frequency"`
	AutomatedTesting bool            `json:"automated_testing"`
	ManualTesting    bool            `json:"manual_testing"`
	EvidenceRequired []string        `json:"evidence_required"`
	TestProcedures   []TestProcedure `json:"test_procedures"`
	ComplianceTarget float64         `json:"compliance_target"`
	CriticalControl  bool            `json:"critical_control"`
	Dependencies     []string        `json:"dependencies"`
	Metadata         map[string]any  `json:"metadata"`
}

SOC2Control represents a SOC 2 control for monitoring

type SOC2Controls

type SOC2Controls struct {
	AccessControl      *AccessControlData      `json:"access_control"`
	DataProtection     *DataProtectionData     `json:"data_protection"`
	SystemMonitoring   *SystemMonitoringData   `json:"system_monitoring"`
	ChangeManagement   *ChangeManagementData   `json:"change_management"`
	RiskAssessment     *RiskAssessmentData     `json:"risk_assessment"`
	IncidentResponse   *IncidentResponseData   `json:"incident_response"`
	VendorManagement   *VendorManagementData   `json:"vendor_management"`
	BusinessContinuity *BusinessContinuityData `json:"business_continuity"`
}

SOC2Controls represents SOC 2 security controls

type SOC2MonitoringConfig

type SOC2MonitoringConfig struct {
	Enabled               bool                     `json:"enabled"`
	MonitoringInterval    time.Duration            `json:"monitoring_interval"`
	ControlTestFrequency  map[string]time.Duration `json:"control_test_frequency"`
	EvidenceRetentionDays int                      `json:"evidence_retention_days"`
	ExceptionThreshold    int                      `json:"exception_threshold"`
	AlertingEnabled       bool                     `json:"alerting_enabled"`
	AutomatedRemediation  bool                     `json:"automated_remediation"`
	ContinuousAuditing    bool                     `json:"continuous_auditing"`
	RealTimeReporting     bool                     `json:"real_time_reporting"`
	ComplianceThreshold   float64                  `json:"compliance_threshold"`
}

SOC2MonitoringConfig configuration for continuous monitoring

type SOC2TypeIIConfig

type SOC2TypeIIConfig struct {
	Enabled                bool          `json:"enabled"`
	ControlPeriodMonths    int           `json:"control_period_months"`
	ContinuousMonitoring   bool          `json:"continuous_monitoring"`
	AutomatedTesting       bool          `json:"automated_testing"`
	ExceptionThreshold     int           `json:"exception_threshold"`
	ReportingFrequency     time.Duration `json:"reporting_frequency"`
	ControlObjectives      []string      `json:"control_objectives"`
	EvidenceRetentionYears int           `json:"evidence_retention_years"`
}

SOC2TypeIIConfig for SOC 2 Type II compliance automation

type SSMIPAuthorizer added in v1.0.36

type SSMIPAuthorizer struct {
	// contains filtered or unexported fields
}

SSMIPAuthorizer handles IP authorization using AWS SSM parameters with caching

func NewSSMIPAuthorizer added in v1.0.36

func NewSSMIPAuthorizer(ctx context.Context) (*SSMIPAuthorizer, error)

NewSSMIPAuthorizer creates a new SSM IP authorizer with default AWS config

func NewSSMIPAuthorizerWithClient added in v1.0.36

func NewSSMIPAuthorizerWithClient(ssmClient *ssm.Client) *SSMIPAuthorizer

NewSSMIPAuthorizerWithClient creates a new SSM IP authorizer with a provided SSM client

func NewSSMIPAuthorizerWithConfig added in v1.0.36

func NewSSMIPAuthorizerWithConfig(ssmClient *ssm.Client, config SSMIPAuthorizerConfig) *SSMIPAuthorizer

NewSSMIPAuthorizerWithConfig creates a new SSM IP authorizer with a provided SSM client and config

func (*SSMIPAuthorizer) ClearCache added in v1.0.36

func (s *SSMIPAuthorizer) ClearCache()

ClearCache clears the IP list cache

func (*SSMIPAuthorizer) GetCacheStats added in v1.0.36

func (s *SSMIPAuthorizer) GetCacheStats() (items int, expired int)

GetCacheStats returns basic cache statistics

func (*SSMIPAuthorizer) IsAuthorizedIP added in v1.0.36

func (s *SSMIPAuthorizer) IsAuthorizedIP(ctx context.Context, sourceIP string, ssmParameterName string) (bool, error)

IsAuthorizedIP checks if the source IP is in the allowed list retrieved from SSM with caching

type SSMIPAuthorizerConfig added in v1.0.36

type SSMIPAuthorizerConfig struct {
	// CacheTTL is the duration to cache IP lists. Defaults to 15 minutes.
	CacheTTL time.Duration
}

SSMIPAuthorizerConfig configures the SSM IP authorizer

type ScheduledTask

type ScheduledTask struct {
	ID        string        `json:"id"`
	Name      string        `json:"name"`
	Type      string        `json:"type"`
	Frequency time.Duration `json:"frequency"`
	LastRun   time.Time     `json:"last_run"`
	NextRun   time.Time     `json:"next_run"`
	Enabled   bool          `json:"enabled"`
	TaskFunc  func() error  `json:"-"`
}

ScheduledTask represents a scheduled monitoring task

type SecretCache

type SecretCache struct {
	// contains filtered or unexported fields
}

SecretCache provides in-memory caching for secrets with TTL

func NewSecretCache

func NewSecretCache(ttl time.Duration) *SecretCache

NewSecretCache creates a new secret cache with the specified TTL

func (*SecretCache) CleanupExpired

func (c *SecretCache) CleanupExpired()

CleanupExpired removes expired secrets from the cache

func (*SecretCache) Clear

func (c *SecretCache) Clear()

Clear removes all values from the cache

func (*SecretCache) Delete

func (c *SecretCache) Delete(key string)

Delete removes a value from the cache

func (*SecretCache) Get

func (c *SecretCache) Get(key string) string

Get retrieves a value from the cache

func (*SecretCache) Set

func (c *SecretCache) Set(key, value string)

Set stores a value in the cache with TTL

func (*SecretCache) Size

func (c *SecretCache) Size() int

Size returns the number of cached secrets

type SecretsProvider

type SecretsProvider interface {
	GetSecret(ctx context.Context, name string) (string, error)
	PutSecret(ctx context.Context, name string, value string) error
	RotateSecret(ctx context.Context, name string) error
	DeleteSecret(ctx context.Context, name string) error
}

SecretsProvider defines the interface for secrets management

type SecurityConfig

type SecurityConfig struct {
	// Authentication settings
	JWTConfig    JWTConfig    `json:"jwt_config"`
	APIKeyConfig APIKeyConfig `json:"api_key_config"`

	// Authorization settings
	RBACEnabled  bool     `json:"rbac_enabled"`
	DefaultRoles []string `json:"default_roles"`

	// Multi-tenant security
	TenantValidation bool `json:"tenant_validation"`
	CrossAccountAuth bool `json:"cross_account_auth"`

	// Encryption settings
	EncryptionAtRest bool   `json:"encryption_at_rest"`
	KMSKeyID         string `json:"kms_key_id"`

	// Request security
	RequestSigning bool  `json:"request_signing"`
	MaxRequestSize int64 `json:"max_request_size"`

	// Secrets management
	SecretsProvider SecretsProvider `json:"-"` // Don't serialize the provider
}

SecurityConfig defines the overall security configuration for the Lift framework

func DefaultSecurityConfig

func DefaultSecurityConfig() *SecurityConfig

DefaultSecurityConfig returns a secure default configuration

func (*SecurityConfig) Validate

func (c *SecurityConfig) Validate() error

Validate checks if the security configuration is valid

type SecurityContext

type SecurityContext struct {
	ThreatLevel      string   `json:"threat_level"`
	AuthMethod       string   `json:"auth_method"`
	EncryptionUsed   bool     `json:"encryption_used"`
	AccessLevel      string   `json:"access_level"`
	SecurityControls []string `json:"security_controls"`
	ThreatIndicators []string `json:"threat_indicators"`
}

SecurityContext provides security-specific context

type SecurityError

type SecurityError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

SecurityError represents a security-related error

func NewSecurityError

func NewSecurityError(code, message string) *SecurityError

NewSecurityError creates a new security error

func (*SecurityError) Error

func (e *SecurityError) Error() string

type SecurityEvent

type SecurityEvent struct {
	EventType   string         `json:"event_type"`
	Severity    string         `json:"severity"`
	Description string         `json:"description"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	Timestamp   time.Time      `json:"timestamp"`
	Resolved    bool           `json:"resolved"`
}

SecurityEvent represents a security-related event

type SecurityLogEntry

type SecurityLogEntry struct {
	Timestamp time.Time      `json:"timestamp"`
	EventType string         `json:"event_type"`
	Severity  string         `json:"severity"`
	Source    string         `json:"source"`
	UserID    string         `json:"user_id"`
	Action    string         `json:"action"`
	Resource  string         `json:"resource"`
	Result    string         `json:"result"`
	IPAddress string         `json:"ip_address"`
	UserAgent string         `json:"user_agent"`
	Details   map[string]any `json:"details"`
}

SecurityLogEntry represents a security log entry

type StepResult

type StepResult struct {
	StepID    string        `json:"step_id"`
	Status    string        `json:"status"`
	StartTime time.Time     `json:"start_time"`
	EndTime   time.Time     `json:"end_time"`
	Duration  time.Duration `json:"duration"`
	Output    string        `json:"output"`
	Error     string        `json:"error,omitempty"`
	Validated bool          `json:"validated"`
}

StepResult represents the result of a remediation step

type SystemEvidence

type SystemEvidence struct {
	CollectionDate    time.Time          `json:"collection_date"`
	SystemMetrics     map[string]any     `json:"system_metrics"`
	SecurityLogs      []SecurityLogEntry `json:"security_logs"`
	AccessLogs        []AccessLogEntry   `json:"access_logs"`
	ConfigurationData map[string]any     `json:"configuration_data"`
	NetworkData       map[string]any     `json:"network_data"`
	Metadata          map[string]any     `json:"metadata"`
}

SystemEvidence represents system-wide evidence

type SystemMonitoringData

type SystemMonitoringData struct {
	LoggingEnabled     bool          `json:"logging_enabled"`
	MonitoringEnabled  bool          `json:"monitoring_enabled"`
	AlertingEnabled    bool          `json:"alerting_enabled"`
	LogRetention       time.Duration `json:"log_retention"`
	LogIntegrity       bool          `json:"log_integrity"`
	RealTimeMonitoring bool          `json:"real_time_monitoring"`
	AnomalyDetection   bool          `json:"anomaly_detection"`
	ThreatDetection    bool          `json:"threat_detection"`
	IncidentTracking   bool          `json:"incident_tracking"`
}

SystemMonitoringData for system monitoring controls

type TenantRiskProfile

type TenantRiskProfile struct {
	TenantID        string             `json:"tenant_id"`
	BaselineRisk    float64            `json:"baseline_risk"`
	RiskTrend       string             `json:"risk_trend"`
	ComplianceScore float64            `json:"compliance_score"`
	SecurityPosture map[string]float64 `json:"security_posture"`
	IncidentHistory []IncidentRecord   `json:"incident_history"`
	LastUpdated     time.Time          `json:"last_updated"`
	Metadata        map[string]any     `json:"metadata"`
}

TenantRiskProfile represents a tenant's risk profile

type TestProcedure

type TestProcedure struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Type        string         `json:"type"` // "inquiry", "observation", "inspection", "reperformance"
	Automated   bool           `json:"automated"`
	Description string         `json:"description"`
	Steps       []string       `json:"steps"`
	Expected    string         `json:"expected"`
	Parameters  map[string]any `json:"parameters"`
}

TestProcedure defines how to test a control

type ThreatIndicator

type ThreatIndicator struct {
	Type        string    `json:"type"`
	Value       string    `json:"value"`
	Confidence  float64   `json:"confidence"`
	Severity    string    `json:"severity"`
	Source      string    `json:"source"`
	FirstSeen   time.Time `json:"first_seen"`
	LastSeen    time.Time `json:"last_seen"`
	Description string    `json:"description"`
}

ThreatIndicator represents a threat indicator

type ThreatIntelligence

type ThreatIntelligence struct {
	ThreatLevel     string             `json:"threat_level"`
	ActiveThreats   []ThreatIndicator  `json:"active_threats"`
	RiskFactors     []ThreatRiskFactor `json:"risk_factors"`
	GeographicRisks map[string]float64 `json:"geographic_risks"`
	IndustryThreats []string           `json:"industry_threats"`
	LastUpdated     time.Time          `json:"last_updated"`
	Metadata        map[string]any     `json:"metadata"`
}

ThreatIntelligence represents threat intelligence data

type ThreatRiskFactor

type ThreatRiskFactor struct {
	RiskFactor
	ThreatType    string  `json:"threat_type"`
	Prevalence    float64 `json:"prevalence"`
	Effectiveness float64 `json:"effectiveness"`
	Mitigation    string  `json:"mitigation"`
}

ThreatRiskFactor represents a threat-based risk factor

type ThreatVector

type ThreatVector struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Severity    string   `json:"severity"`
	Frequency   string   `json:"frequency"`
	Targets     []string `json:"targets"`
	Indicators  []string `json:"indicators"`
	Mitigations []string `json:"mitigations"`
}

ThreatVector represents a threat vector

type TimeRange

type TimeRange struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

TimeRange represents a time range

type TrainingExample

type TrainingExample struct {
	Features []float64      `json:"features"`
	Label    float64        `json:"label"`
	Weight   float64        `json:"weight"`
	Metadata map[string]any `json:"metadata"`
}

TrainingExample represents a training example for the risk model

type TransferValidation

type TransferValidation struct {
	Valid           bool              `json:"valid"`
	ValidationDate  time.Time         `json:"validation_date"`
	LegalBasisValid bool              `json:"legal_basis_valid"`
	SafeguardsValid bool              `json:"safeguards_valid"`
	Issues          []ValidationIssue `json:"issues"`
	Recommendations []string          `json:"recommendations"`
	Metadata        map[string]any    `json:"metadata"`
}

TransferValidation represents validation of cross-border transfer

type TrendAnalysis

type TrendAnalysis struct {
	Direction   string          `json:"direction"`
	Magnitude   float64         `json:"magnitude"`
	Confidence  float64         `json:"confidence"`
	Seasonality bool            `json:"seasonality"`
	Forecast    []ForecastPoint `json:"forecast"`
	Metadata    map[string]any  `json:"metadata"`
}

TrendAnalysis represents trend analysis results

type TrendAnomaly

type TrendAnomaly struct {
	Timestamp     time.Time `json:"timestamp"`
	Value         float64   `json:"value"`
	ExpectedValue float64   `json:"expected_value"`
	Deviation     float64   `json:"deviation"`
	Severity      string    `json:"severity"`
}

TrendAnomaly represents an anomaly in trend data

type TrendDataPoint

type TrendDataPoint struct {
	Timestamp      time.Time `json:"timestamp"`
	Value          float64   `json:"value"`
	PredictedValue float64   `json:"predicted_value"`
	Confidence     float64   `json:"confidence"`
}

TrendDataPoint represents a data point in trend analysis

type TrendPrediction

type TrendPrediction struct {
	Metric      string           `json:"metric"`
	Timeframe   time.Duration    `json:"timeframe"`
	Direction   string           `json:"direction"` // "increasing", "decreasing", "stable"
	Magnitude   float64          `json:"magnitude"`
	Confidence  float64          `json:"confidence"`
	DataPoints  []TrendDataPoint `json:"data_points"`
	Seasonality bool             `json:"seasonality"`
	Anomalies   []TrendAnomaly   `json:"anomalies"`
	Metadata    map[string]any   `json:"metadata"`
}

TrendPrediction represents a trend prediction

type URL

type URL interface {
	Query() map[string][]string
}

URL represents the minimal URL interface needed

type UserRiskProfile

type UserRiskProfile struct {
	UserID           string             `json:"user_id"`
	BaselineRisk     float64            `json:"baseline_risk"`
	RiskTrend        string             `json:"risk_trend"`
	BehaviorPatterns map[string]float64 `json:"behavior_patterns"`
	AccessPatterns   map[string]float64 `json:"access_patterns"`
	AnomalyHistory   []AnomalyRecord    `json:"anomaly_history"`
	LastUpdated      time.Time          `json:"last_updated"`
	Metadata         map[string]any     `json:"metadata"`
}

UserRiskProfile represents a user's risk profile

type ValidationIssue

type ValidationIssue struct {
	ID          string `json:"id"`
	Severity    string `json:"severity"`
	Category    string `json:"category"`
	Description string `json:"description"`
	Remediation string `json:"remediation"`
}

ValidationIssue represents a validation issue

type ValidationResult

type ValidationResult struct {
	Valid       bool               `json:"valid"`
	Score       float64            `json:"score"`
	Issues      []string           `json:"issues"`
	Metrics     map[string]float64 `json:"metrics"`
	ValidatedAt time.Time          `json:"validated_at"`
}

ValidationResult represents validation result

type VendorManagementData

type VendorManagementData struct {
	VendorID         string    `json:"vendor_id"`
	VendorName       string    `json:"vendor_name"`
	ServiceType      string    `json:"service_type"`
	RiskRating       string    `json:"risk_rating"`
	ContractDate     time.Time `json:"contract_date"`
	ReviewDate       time.Time `json:"review_date"`
	ComplianceStatus string    `json:"compliance_status"`
	AuditCompleted   bool      `json:"audit_completed"`
	SLAMet           bool      `json:"sla_met"`
}

VendorManagementData for vendor management controls

type Vulnerability

type Vulnerability struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Severity    string   `json:"severity"`
	CVSS        float64  `json:"cvss"`
	Description string   `json:"description"`
	Impact      string   `json:"impact"`
	Remediation []string `json:"remediation"`
	Status      string   `json:"status"`
}

Vulnerability represents a vulnerability

type WidgetConfig

type WidgetConfig struct {
	ChartType   string             `json:"chart_type"`
	DataSource  string             `json:"data_source"`
	RefreshRate time.Duration      `json:"refresh_rate"`
	Filters     map[string]any     `json:"filters"`
	Aggregation string             `json:"aggregation"`
	TimeRange   TimeRange          `json:"time_range"`
	Thresholds  map[string]float64 `json:"thresholds"`
	Colors      map[string]string  `json:"colors"`
	Metadata    map[string]any     `json:"metadata"`
}

WidgetConfig represents widget configuration

type WidgetPosition

type WidgetPosition struct {
	X int `json:"x"`
	Y int `json:"y"`
}

WidgetPosition represents widget position

type WidgetSize

type WidgetSize struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

WidgetSize represents widget size

Jump to

Keyboard shortcuts

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