Documentation
¶
Index ¶
- Variables
- type ActionTaken
- type AlertEvent
- type Alerter
- func (a *Alerter) Close()
- func (a *Alerter) TriggerAuthFail(ctx context.Context, requestID, reason string)
- func (a *Alerter) TriggerBlockAlert(ctx context.Context, ...)
- func (a *Alerter) TriggerFailClosed(ctx context.Context, requestID, reason string)
- func (a *Alerter) TriggerLoopAlert(ctx context.Context, ...)
- func (a *Alerter) TriggerThresholdAlerts(ctx context.Context, requestID, keyHash, keyName, provider string, ...)
- type AlertingConfig
- type BudgetExceededAlert
- type EventSource
- type LoopDetectedAlert
- type OWASPMetadata
- type SecurityEventEnvelope
- func NewAuthFailEvent(ctx context.Context, requestID string, reason string, details interface{}) *SecurityEventEnvelope
- func NewBudgetBlockEvent(ctx context.Context, requestID string, details interface{}) *SecurityEventEnvelope
- func NewBudgetThresholdEvent(ctx context.Context, requestID string, details interface{}) *SecurityEventEnvelope
- func NewFailClosedEvent(ctx context.Context, requestID string, reason string, details interface{}) *SecurityEventEnvelope
- func NewLoopBlockEvent(ctx context.Context, requestID string, details interface{}) *SecurityEventEnvelope
- func NewLoopWarnEvent(ctx context.Context, requestID string, details interface{}) *SecurityEventEnvelope
- type ThresholdAlert
- type ThresholdConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var Version = "dev" // Injected via -ldflags at build time
Functions ¶
This section is empty.
Types ¶
type ActionTaken ¶
type AlertEvent ¶
type AlertEvent interface {
EventType() string
}
type Alerter ¶
type Alerter struct {
// contains filtered or unexported fields
}
func NewAlerter ¶
func NewAlerter(cfg AlertingConfig, rdb *redis.Client) *Alerter
func (*Alerter) TriggerAuthFail ¶
func (*Alerter) TriggerBlockAlert ¶
func (*Alerter) TriggerFailClosed ¶
func (*Alerter) TriggerLoopAlert ¶
type AlertingConfig ¶
type AlertingConfig struct {
WebhookURL string `mapstructure:"webhook_url"`
WebhookSecret string `mapstructure:"webhook_secret"`
BufferSize int `mapstructure:"buffer_size"`
Thresholds []ThresholdConfig `mapstructure:"thresholds"`
}
type BudgetExceededAlert ¶
type BudgetExceededAlert struct {
KeyHash string `json:"key_hash"`
KeyName string `json:"key_name"`
Provider string `json:"provider"`
Model string `json:"model"`
Window string `json:"window"`
CurrentSpendUSD float64 `json:"current_spend_usd"`
BudgetLimitUSD float64 `json:"budget_limit_usd"`
BlockedRequestCostUSD float64 `json:"blocked_request_cost_usd"`
}
type EventSource ¶
type LoopDetectedAlert ¶
type OWASPMetadata ¶
type SecurityEventEnvelope ¶
type SecurityEventEnvelope struct {
SchemaVersion string `json:"schema_version"`
EventID string `json:"event_id"`
LoopersEventType string `json:"loopers_event_type"`
TraceID string `json:"trace_id,omitempty"`
SpanID string `json:"span_id,omitempty"`
RequestID string `json:"request_id,omitempty"`
Timestamp string `json:"timestamp"`
Source EventSource `json:"source"`
OWASP OWASPMetadata `json:"owasp"`
Regulation []string `json:"regulation,omitempty"`
Action ActionTaken `json:"action"`
Event string `json:"event"`
Details interface{} `json:"details"`
}
SecurityEventEnvelope wraps every security event with traceability fields required by EU AI Act Article 14 (human oversight) and Article 12 (record-keeping).
func NewAuthFailEvent ¶
func NewAuthFailEvent(ctx context.Context, requestID string, reason string, details interface{}) *SecurityEventEnvelope
func NewBudgetBlockEvent ¶
func NewBudgetBlockEvent(ctx context.Context, requestID string, details interface{}) *SecurityEventEnvelope
func NewBudgetThresholdEvent ¶
func NewBudgetThresholdEvent(ctx context.Context, requestID string, details interface{}) *SecurityEventEnvelope
func NewFailClosedEvent ¶
func NewFailClosedEvent(ctx context.Context, requestID string, reason string, details interface{}) *SecurityEventEnvelope
func NewLoopBlockEvent ¶
func NewLoopBlockEvent(ctx context.Context, requestID string, details interface{}) *SecurityEventEnvelope
func NewLoopWarnEvent ¶
func NewLoopWarnEvent(ctx context.Context, requestID string, details interface{}) *SecurityEventEnvelope
func (*SecurityEventEnvelope) EventType ¶
func (e *SecurityEventEnvelope) EventType() string
EventType implements the AlertEvent interface.
type ThresholdAlert ¶
type ThresholdAlert struct {
KeyHash string `json:"key_hash"`
KeyName string `json:"key_name"`
Provider string `json:"provider"`
Window string `json:"window"`
ThresholdPercent int `json:"threshold_percent"`
CurrentSpendUSD float64 `json:"current_spend_usd"`
BudgetLimitUSD float64 `json:"budget_limit_usd"`
Message string `json:"message"`
}
type ThresholdConfig ¶
Click to show internal directories.
Click to hide internal directories.