notify

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateFilename

func GenerateFilename(moduleID, host, ext string) string

GenerateFilename creates a filename for attachments. Format: {moduleID}_{host}_{timestamp}.{ext}

func SanitizeFilename

func SanitizeFilename(name string) string

SanitizeFilename replaces invalid filename characters with underscores.

func Truncate

func Truncate(s string, maxLen int) string

Truncate truncates a string to maxLen bytes with ellipsis "...", never splitting a UTF-8 sequence (chat APIs reject invalid UTF-8).

func TruncateWithIndicator

func TruncateWithIndicator(s string, maxLen int) string

TruncateWithIndicator truncates a string and adds "[see attachment]", never splitting a UTF-8 sequence.

Types

type Backend

type Backend interface {
	// Send sends a scan result notification.
	Send(result *output.ResultEvent) error

	// SendRaw sends a raw text message (for panics, errors).
	SendRaw(msg string) error

	// Close releases any resources held by the backend.
	Close()
}

Backend is the interface for notification backends. Each backend handles its own formatting, escaping, length limits, and file uploads.

type Config

type Config struct {
	// Backends to send notifications to
	Backends []Backend

	// AllowedSeverities filters which severities to notify.
	// Use "all" to notify all severities.
	AllowedSeverities []string

	// QueueSize is the notification queue buffer size.
	// Default: 1000
	QueueSize int

	// ShutdownTimeout is how long to wait for pending notifications on Close.
	// Default: 30s
	ShutdownTimeout time.Duration

	// RedactHeaders are extra lowercased header names (operator -H, live
	// session) whose values are scrubbed from notifications on top of the
	// built-in credential table.
	RedactHeaders map[string]struct{}
	// NoRedact sends the raw evidence (output.redact_evidence: false).
	NoRedact bool
}

Config configures the notification Manager.

type Manager

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

Manager manages async notification queue and multiple backends.

func New

func New(cfg Config) *Manager

New creates a new notification Manager.

func (*Manager) Close

func (m *Manager) Close()

Close waits for all pending notifications to be sent, then closes all backends.

func (*Manager) Send

func (m *Manager) Send(result *output.ResultEvent) error

Send queues a scan result notification (non-blocking). Returns immediately after queueing.

func (*Manager) SendRaw

func (m *Manager) SendRaw(msg string) error

SendRaw queues a raw text message (non-blocking).

Directories

Path Synopsis
Package webhook fires a single HTTP POST when a scan reaches a terminal state (completed, failed or cancelled).
Package webhook fires a single HTTP POST when a scan reaches a terminal state (completed, failed or cancelled).

Jump to

Keyboard shortcuts

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