incident

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IncidentDirName = ".dsops/incidents"
	AuditLogName    = ".dsops/audit.log"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubConfig

type GitHubConfig struct {
	Token      string   `yaml:"token"`            // GitHub personal access token
	Owner      string   `yaml:"owner"`            // Repository owner
	Repository string   `yaml:"repository"`       // Repository name
	Labels     []string `yaml:"labels,omitempty"` // Labels to add to issues
}

GitHubConfig holds GitHub integration configuration

type Manager

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

Manager handles incident creation and management

func NewManager

func NewManager(baseDir string) *Manager

NewManager creates a new incident manager

func (*Manager) AddNotification

func (m *Manager) AddNotification(report *Report, channel string, success bool, details string) error

AddNotification records a notification being sent

func (*Manager) CreateReport

func (m *Manager) CreateReport(incidentType, severity, title, description string, details map[string]string) (*Report, error)

CreateReport creates a new incident report

func (*Manager) GetIncidentsByType

func (m *Manager) GetIncidentsByType(incidentType string) ([]*Report, error)

GetIncidentsByType returns incidents of a specific type

func (*Manager) GetOpenIncidents

func (m *Manager) GetOpenIncidents() ([]*Report, error)

GetOpenIncidents returns all open incidents

func (*Manager) ListReports

func (m *Manager) ListReports() ([]*Report, error)

ListReports returns all incident reports

func (*Manager) LoadReport

func (m *Manager) LoadReport(id string) (*Report, error)

LoadReport loads an incident report by ID

func (*Manager) ResolveReport

func (m *Manager) ResolveReport(report *Report, resolutionNotes string) error

ResolveReport marks an incident as resolved

func (*Manager) SaveReport

func (m *Manager) SaveReport(report *Report) error

SaveReport saves an incident report to disk

func (*Manager) UpdateReport

func (m *Manager) UpdateReport(report *Report) error

UpdateReport updates an existing report

type NotificationConfig

type NotificationConfig struct {
	Slack  *SlackConfig  `yaml:"slack,omitempty"`
	GitHub *GitHubConfig `yaml:"github,omitempty"`
}

NotificationConfig holds configuration for incident notifications

type NotificationRecord

type NotificationRecord struct {
	Channel   string    `json:"channel"` // slack, github, email
	Timestamp time.Time `json:"timestamp"`
	Success   bool      `json:"success"`
	Details   string    `json:"details,omitempty"`
}

NotificationRecord tracks sent notifications

type Notifier

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

Notifier handles sending incident notifications

func NewNotifier

func NewNotifier(config NotificationConfig) *Notifier

NewNotifier creates a new notifier

func (*Notifier) SendNotifications

func (n *Notifier) SendNotifications(report *Report) []NotificationRecord

SendNotifications sends notifications to all configured channels

type Report

type Report struct {
	ID          string            `json:"id"`
	Timestamp   time.Time         `json:"timestamp"`
	Type        string            `json:"type"`
	Severity    string            `json:"severity"` // critical, high, medium, low
	Title       string            `json:"title"`
	Description string            `json:"description"`
	Details     map[string]string `json:"details"`

	// Affected resources
	AffectedFiles   []string `json:"affected_files,omitempty"`
	AffectedSecrets []string `json:"affected_secrets,omitempty"`
	AffectedCommits []string `json:"affected_commits,omitempty"`

	// Response actions
	ActionsRequired []string `json:"actions_required"`
	ActionsTaken    []string `json:"actions_taken,omitempty"`

	// Notification status
	NotificationsSent []NotificationRecord `json:"notifications_sent,omitempty"`

	// Resolution
	Status          string     `json:"status"` // open, investigating, resolved
	ResolvedAt      *time.Time `json:"resolved_at,omitempty"`
	ResolutionNotes string     `json:"resolution_notes,omitempty"`
}

Report represents a security incident report

type SlackConfig

type SlackConfig struct {
	WebhookURL string `yaml:"webhook_url"`
	Channel    string `yaml:"channel,omitempty"`
	Username   string `yaml:"username,omitempty"`
}

SlackConfig holds Slack webhook configuration

Jump to

Keyboard shortcuts

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