alerts

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package alerts is the producer-facing seam for security alerting. It owns the alert Payload DTO and a publish-once dispatch indirection, so alert producers (the scan engines, policy, …) can fire alerts without depending on the webhook-delivery implementation, which stays in package main and is installed once at startup via SetSink. ADR-0002/0003 (sibling to the obs sink seam).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fire

func Fire(event string, p Payload)

Fire dispatches an alert through the installed sink. It is a no-op when no sink is installed (e.g. unit tests that never wire alerting), so producers never need a nil check or a dependency on the delivery layer.

func SetSink

func SetSink(fn Sink)

SetSink installs the dispatch implementation. Intended to be called once at startup (publish-once); a later call atomically replaces the sink.

Types

type Payload

type Payload struct {
	Event     string `json:"event"`
	Timestamp string `json:"timestamp"`
	Actor     string `json:"actor"` // client IP or username
	Host      string `json:"host"`
	Detail    string `json:"detail"` // virus name / rule name / pattern
	Source    string `json:"source"` // "clamav","yara","threatfeed","policy","auth"
}

Payload is the JSON body delivered to webhooks for a security event.

type Sink

type Sink func(event string, p Payload)

Sink dispatches an alert. The real implementation (webhook fan-out, retry, HMAC signing, SSRF-guarded delivery) lives in package main.

Jump to

Keyboard shortcuts

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