reporter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashURI added in v0.2.0

func HashURI(rawURI string) string

HashURI produces a sha256 hash of the URI with credentials stripped.

func Write

func Write(w io.Writer, report *Report, format Format, opts ...WriteOptions) error

Write outputs the report in the given format.

Types

type Format

type Format string

Format controls report output format.

const (
	FormatText       Format = "text"
	FormatJSON       Format = "json"
	FormatSARIF      Format = "sarif"
	FormatSpectreHub Format = "spectrehub"
)

type Metadata

type Metadata struct {
	Tool      string `json:"tool"`
	Version   string `json:"version"`
	Command   string `json:"command"`
	Timestamp string `json:"timestamp"`
	URIHash   string `json:"uri_hash,omitempty"`
	Database  string `json:"database,omitempty"`
}

Metadata holds report context.

type Report

type Report struct {
	Metadata    Metadata           `json:"metadata"`
	Findings    []analyzer.Finding `json:"findings"`
	MaxSeverity analyzer.Severity  `json:"maxSeverity"`
	Summary     Summary            `json:"summary"`
	Scanned     ScanContext        `json:"scanned,omitempty"`
}

Report is the top-level audit/check output.

func NewReport

func NewReport(command string, findings []analyzer.Finding, version string) Report

NewReport builds a report from findings.

type ScanContext

type ScanContext struct {
	Tables  int `json:"tables"`
	Indexes int `json:"indexes"`
	Schemas int `json:"schemas"`
}

ScanContext holds context about what was scanned.

type SpectreHubEnvelope added in v0.2.0

type SpectreHubEnvelope struct {
	Schema    string              `json:"schema"`
	Tool      string              `json:"tool"`
	Version   string              `json:"version"`
	Timestamp string              `json:"timestamp"`
	Target    SpectreHubTarget    `json:"target"`
	Findings  []SpectreHubFinding `json:"findings"`
	Summary   SpectreHubSummary   `json:"summary"`
}

SpectreHubEnvelope is the spectre/v1 cross-tool ingestion format.

type SpectreHubFinding added in v0.2.0

type SpectreHubFinding struct {
	ID       string         `json:"id"`
	Severity string         `json:"severity"`
	Location string         `json:"location"`
	Message  string         `json:"message"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

SpectreHubFinding is a single finding in the spectre/v1 format.

type SpectreHubSummary added in v0.2.0

type SpectreHubSummary struct {
	Total  int `json:"total"`
	High   int `json:"high"`
	Medium int `json:"medium"`
	Low    int `json:"low"`
	Info   int `json:"info"`
}

SpectreHubSummary counts findings by severity.

type SpectreHubTarget added in v0.2.0

type SpectreHubTarget struct {
	Type     string `json:"type"`
	URIHash  string `json:"uri_hash"`
	Database string `json:"database,omitempty"`
}

SpectreHubTarget describes the audited system.

type Summary

type Summary struct {
	Total  int `json:"total"`
	High   int `json:"high"`
	Medium int `json:"medium"`
	Low    int `json:"low"`
	Info   int `json:"info"`
}

Summary counts findings by severity.

type WriteOptions

type WriteOptions struct {
	NoColor bool
}

WriteOptions controls text output behavior.

Jump to

Keyboard shortcuts

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