report

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package report renders scan results: a terminal report, JSON, SARIF and diffs between scans. The CLI and the dashboard share it.

Index

Constants

View Source
const (
	NodeDomain  = "domain"
	NodeHost    = "host"
	NodeService = "service"
	NodeRoute   = "route"
)

Node kinds in the attack-surface tree.

Variables

View Source
var (
	OWASPTop10 = []struct{ ID, Name string }{
		{"A01:2021", "Broken access control"},
		{"A02:2021", "Cryptographic failures"},
		{"A03:2021", "Injection"},
		{"A04:2021", "Insecure design"},
		{"A05:2021", "Security misconfiguration"},
		{"A06:2021", "Vulnerable and outdated components"},
		{"A07:2021", "Identification and authentication failures"},
		{"A08:2021", "Software and data integrity failures"},
		{"A09:2021", "Security logging and monitoring failures"},
		{"A10:2021", "Server-side request forgery"},
	}
	ASVSChapters = []struct{ ID, Name string }{
		{"V1", "Architecture, design and threat modeling"},
		{"V2", "Authentication"},
		{"V3", "Session management"},
		{"V4", "Access control"},
		{"V5", "Validation, sanitization and encoding"},
		{"V6", "Stored cryptography"},
		{"V7", "Error handling and logging"},
		{"V8", "Data protection"},
		{"V9", "Communication"},
		{"V10", "Malicious code"},
		{"V11", "Business logic"},
		{"V12", "Files and resources"},
		{"V13", "API and web service"},
		{"V14", "Configuration"},
	}
)

Standard categories used by the compliance view.

Functions

func HTML

func HTML(w io.Writer, results []Result, opts HTMLOptions) error

HTML writes a self-contained, printable report for results. All text from scans is escaped by html/template.

func JSON

func JSON(w io.Writer, version string, results []Result) error

JSON writes results as an indented JSON document.

func Markdown added in v0.3.2

func Markdown(w io.Writer, results []Result) error

Markdown writes a developer-facing report: a summary per target, then every open finding with evidence and concrete remediation — the thing you hand to an engineer to fix the vulnerabilities.

func Pretty

func Pretty(w io.Writer, r Result, opts PrettyOptions) error

Pretty writes the human-readable terminal report.

func PrettyDiff

func PrettyDiff(w io.Writer, d Diff, color bool) error

PrettyDiff writes a diff for the terminal.

func SARIF

func SARIF(w io.Writer, version string, results []Result) error

SARIF writes open findings from every result as one SARIF run.

func SARIFLevel

func SARIFLevel(s core.Severity) string

SARIFLevel maps a severity to a SARIF result level.

func SortFindings

func SortFindings(fs []core.Finding) []core.Finding

SortFindings orders findings worst first: severity, confidence, category, title, then fingerprint for stability.

func Text added in v0.3.2

func Text(w io.Writer, results []Result) error

Text writes a plain-text version of the developer report (no Markdown syntax), for pasting into a ticket or email.

Types

type Cell

type Cell struct {
	Open  int            `json:"open"`
	Worst *core.Severity `json:"worst,omitempty"`
}

Cell is one target's open findings in one category.

type Compliance

type Compliance struct {
	Targets []string        `json:"targets"`
	OWASP   []ComplianceRow `json:"owasp"`
	ASVS    []ComplianceRow `json:"asvs"`
	// Mapped is how many registered checks declare standards mappings.
	Mapped int `json:"mapped"`
	Total  int `json:"total"`
}

Compliance is the OWASP Top 10 heatmap plus ASVS chapter coverage.

func BuildCompliance

func BuildCompliance(scans []core.ScanResult, checks []core.Check) Compliance

BuildCompliance maps open findings (by their OWASP tags) and registered checks (by StandardsMapper) onto OWASP Top 10 and ASVS chapters.

type ComplianceRow

type ComplianceRow struct {
	ID      string          `json:"id"`
	Name    string          `json:"name"`
	Checks  int             `json:"checks"`
	Targets map[string]Cell `json:"targets,omitempty"`
}

ComplianceRow is one standard category: how many checks cover it and the open findings per target.

type Diff

type Diff struct {
	From      string         `json:"from"`
	To        string         `json:"to"`
	New       []core.Finding `json:"new"`
	Regressed []core.Finding `json:"regressed"`
	Fixed     []core.Finding `json:"fixed"`
	Unchanged []core.Finding `json:"unchanged"`
}

Diff is what changed between two scans, matched by fingerprint.

func DiffScans

func DiffScans(a, b core.ScanResult, seenBefore func(fingerprint string) bool) Diff

DiffScans compares scan a (before) with scan b (after). seenBefore reports whether a fingerprint appeared in any scan older than a; a finding that is back after being absent is a regression, not new. seenBefore may be nil.

type Document

type Document struct {
	Tool    string   `json:"tool"`
	Version string   `json:"version"`
	Results []Result `json:"results"`
}

Document is the --json output: one entry per scanned target.

type HTMLOptions

type HTMLOptions struct {
	Title     string
	Version   string
	Generated time.Time
	// FixNext limits the fix-next list per target (default 10).
	FixNext int
}

HTMLOptions configure the HTML report.

type Node

type Node struct {
	ID       string         `json:"id"`
	Kind     string         `json:"kind"`
	Label    string         `json:"label"`
	Worst    *core.Severity `json:"worst,omitempty"` // worst open severity here or below
	Open     int            `json:"open"`            // open findings here or below
	Children []*Node        `json:"children,omitempty"`
}

Node is one point of the attack surface: domain → host → service → route.

func Surface

func Surface(scans []core.ScanResult) []*Node

Surface builds the attack-surface tree from scans (normally the latest scan of each target). URL, route and host:port assets become nodes; file and container assets are not network surface and are left out. A target's route table (from scout.Mount) adds routes without findings.

type PrettyOptions

type PrettyOptions struct {
	Color   bool
	FixNext int // how many fix-next items to show; 0 means 5
}

PrettyOptions tune the terminal report.

type Result

type Result struct {
	Scan    core.ScanResult   `json:"scan"`
	Report  scoring.Report    `json:"report"`
	FixNext []scoring.FixItem `json:"fix_next"`
}

Result bundles a scan with its score report and fix-next ranking.

func Build

func Build(scan core.ScanResult, opts scoring.Options) Result

Build scores a scan. Unless opts.Assessed is set, it uses the categories recorded on the scan, so the report grades exactly as the engine did.

Jump to

Keyboard shortcuts

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