exporter

package
v0.0.0-...-9b8dde8 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultSARIFPath is where the SARIF export is written when no --out flag is provided.
	DefaultSARIFPath = filepath.Join(defaultOutputDir, sarifFilename)
	// DefaultJSONLPath is where the JSONL export is written when no --out flag is provided.
	DefaultJSONLPath = filepath.Join(defaultOutputDir, jsonlFilename)
	// DefaultCSVPath is where the CSV export is written when no --out flag is provided.
	DefaultCSVPath = filepath.Join(defaultOutputDir, csvFilename)
)

Functions

func DefaultPath

func DefaultPath(format Format) (string, error)

DefaultPath returns the default output location for the provided format if defined.

func Encode

func Encode(format Format, req Request) ([]byte, error)

Encode resolves the requested format and renders the dataset using the registered implementation.

func EncodeCSV

func EncodeCSV(casesList []cases.Case) ([]byte, error)

EncodeCSV renders cases as comma-separated values suitable for spreadsheets.

func EncodeJSONL

func EncodeJSONL(casesList []cases.Case, telemetry Telemetry) ([]byte, error)

EncodeJSONL renders the telemetry snapshot followed by individual case entries as JSONL.

func EncodeSARIF

func EncodeSARIF(casesList []cases.Case) ([]byte, error)

EncodeSARIF converts cases into a SARIF 2.1.0 log for interoperability with security tooling.

func MustRegisterFormat

func MustRegisterFormat(spec FormatSpec)

MustRegisterFormat adds an exporter to the registry and panics if registration fails.

func RegisterFormat

func RegisterFormat(spec FormatSpec) error

RegisterFormat adds a new exporter implementation to the registry.

Types

type CaseMetrics

type CaseMetrics struct {
	SourceCount   int `json:"source_count"`
	EvidenceCount int `json:"evidence_count"`
}

CaseMetrics captures per-case aggregates emitted alongside case entries.

type EncodeFunc

type EncodeFunc func(Request) ([]byte, error)

EncodeFunc renders the provided dataset into an exportable representation.

type Format

type Format string

Format identifies the supported export encodings.

const (
	// FormatSARIF renders cases in SARIF 2.1.0.
	FormatSARIF Format = "sarif"
	// FormatJSONL renders telemetry and cases as newline-delimited JSON objects.
	FormatJSONL Format = "jsonl"
	// FormatCSV renders a tabular summary of cases.
	FormatCSV Format = "csv"
)

func ParseFormat

func ParseFormat(raw string) (Format, error)

ParseFormat validates the provided format string.

type FormatSpec

type FormatSpec struct {
	Format          Format
	Description     string
	DefaultFilename string
	Encode          EncodeFunc
}

FormatSpec describes an exporter implementation registered at runtime.

func Formats

func Formats() []FormatSpec

Formats returns the registered exporters sorted by format name.

type Request

type Request struct {
	Cases     []cases.Case
	Findings  []findings.Finding
	Telemetry Telemetry
}

Request captures the data set that exporters operate on.

type Telemetry

type Telemetry struct {
	GeneratedAt    findings.Timestamp `json:"generated_at"`
	CaseCount      int                `json:"case_count"`
	FindingCount   int                `json:"finding_count"`
	SeverityCounts map[string]int     `json:"severity_counts"`
	PluginCounts   map[string]int     `json:"plugin_counts"`
}

Telemetry summarises a pipeline export for downstream data lakes.

func BuildTelemetry

func BuildTelemetry(casesList []cases.Case, findingsCount int) Telemetry

BuildTelemetry derives aggregate metrics for the provided cases.

Jump to

Keyboard shortcuts

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