events

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventFilter

type EventFilter struct {
	EventTypes   []EventType `json:"event_types,omitempty"`
	MinSeverity  Severity    `json:"min_severity,omitempty"`
	Sources      []string    `json:"sources,omitempty"`
	ThreatTypes  []string    `json:"threat_types,omitempty"`
	PackageNames []string    `json:"package_names,omitempty"`
}

EventFilter defines criteria for filtering events

type EventMetadata

type EventMetadata struct {
	DetectionMethod string            `json:"detection_method"`
	Tags            []string          `json:"tags,omitempty"`
	CustomFields    map[string]string `json:"custom_fields,omitempty"`
	CorrelationID   string            `json:"correlation_id,omitempty"`
}

EventMetadata contains additional metadata about the event

type EventSubscriber

type EventSubscriber interface {
	Handle(ctx context.Context, event *SecurityEvent) error
	GetID() string
}

EventSubscriber defines the interface for event subscribers

type EventType

type EventType string

EventType represents the type of security event

const (
	EventTypeThreatDetected  EventType = "threat_detected"
	EventTypePackageBlocked  EventType = "package_blocked"
	EventTypePolicyViolation EventType = "policy_violation"
	EventTypeSystemAlert     EventType = "system_alert"
)

type PackageInfo

type PackageInfo struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	Registry string `json:"registry"`
	Hash     string `json:"hash,omitempty"`
	Path     string `json:"path,omitempty"`
}

PackageInfo contains information about the package involved in the event

type SecurityEvent

type SecurityEvent struct {
	ID        string            `json:"id"`
	Timestamp time.Time         `json:"timestamp"`
	Type      EventType         `json:"type"`
	Severity  Severity          `json:"severity"`
	Source    string            `json:"source"`
	Package   PackageInfo       `json:"package"`
	Threat    ThreatInfo        `json:"threat"`
	Metadata  EventMetadata     `json:"metadata"`
	Context   map[string]string `json:"context,omitempty"`
}

SecurityEvent represents a security event in the system

func (*SecurityEvent) MatchesFilter

func (e *SecurityEvent) MatchesFilter(filter *EventFilter) bool

MatchesFilter checks if an event matches the given filter criteria

type Severity

type Severity string

Severity represents the severity level of an event

const (
	SeverityCritical Severity = "critical"
	SeverityHigh     Severity = "high"
	SeverityMedium   Severity = "medium"
	SeverityLow      Severity = "low"
	SeverityInfo     Severity = "info"
)

type ThreatInfo

type ThreatInfo struct {
	Type        string            `json:"type"`
	Confidence  float64           `json:"confidence"`
	RiskScore   float64           `json:"risk_score"`
	Description string            `json:"description"`
	Evidence    map[string]string `json:"evidence,omitempty"`
	Mitigations []string          `json:"mitigations,omitempty"`
}

ThreatInfo contains information about the detected threat

Jump to

Keyboard shortcuts

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