Documentation
¶
Index ¶
Constants ¶
const SchemaVersion = "0.2"
SchemaVersion captures the canonical findings schema version persisted to disk.
Variables ¶
var DefaultFindingsPath = filepath.Join(defaultOutputDir, defaultFilename)
DefaultFindingsPath is the canonical location for persisted findings.
Functions ¶
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus provides an in-process pub/sub system for findings. Multiple subscribers can listen for emitted findings concurrently.
type Finding ¶
type Finding struct {
Version string `json:"version"`
ID string `json:"id"`
Plugin string `json:"plugin"`
Type string `json:"type"`
Message string `json:"message"`
Target string `json:"target,omitempty"`
Evidence string `json:"evidence,omitempty"`
Severity Severity `json:"severity"`
DetectedAt Timestamp `json:"ts"`
Metadata map[string]string `json:"meta,omitempty"`
}
Finding represents a single issue reported by a plugin.
func FromProto ¶
FromProto converts a protobuf Finding emitted by a plugin into the internal representation persisted by 0xgend.
func (Finding) Clone ¶
Clone returns a deep copy of the finding to avoid accidental mutation when broadcasting to subscribers.
type Severity ¶
type Severity string
Severity captures the allowed severity values for findings persisted by the host. The values are normalised to lowercase short codes for stable JSON encoding.
func (Severity) MarshalJSON ¶
MarshalJSON ensures severities are always emitted as quoted strings.
func (*Severity) UnmarshalJSON ¶
UnmarshalJSON performs strict validation so we catch typos during testing and when loading persisted findings.
type Timestamp ¶
Timestamp enforces RFC3339 timestamps when encoding findings to disk.
func NewTimestamp ¶
NewTimestamp normalises the input time before persisting it.
func (Timestamp) MarshalJSON ¶
MarshalJSON renders the timestamp using time.RFC3339. Zero values encode as an empty string so Validate can flag missing timestamps explicitly.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON enforces RFC3339 timestamps when reading persisted findings.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer persists findings to a JSON Lines file with size based rotation.
func NewWriter ¶
func NewWriter(path string, opts ...WriterOption) *Writer
NewWriter constructs a writer targeting the provided path.
type WriterOption ¶
type WriterOption func(*Writer)
WriterOption configures the writer behaviour.
func WithBufferSize ¶
func WithBufferSize(size int) WriterOption
WithBufferSize overrides the buffered writer size.
func WithMaxBytes ¶
func WithMaxBytes(limit int64) WriterOption
WithMaxBytes overrides the rotation threshold. Values <= 0 disable rotation.
func WithMaxRotations ¶
func WithMaxRotations(count int) WriterOption
WithMaxRotations sets how many rotated files are retained. Values < 1 keep a single log file without rotation history.