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
- Variables
- func HTML(w io.Writer, results []Result, opts HTMLOptions) error
- func JSON(w io.Writer, version string, results []Result) error
- func Markdown(w io.Writer, results []Result) error
- func Pretty(w io.Writer, r Result, opts PrettyOptions) error
- func PrettyDiff(w io.Writer, d Diff, color bool) error
- func SARIF(w io.Writer, version string, results []Result) error
- func SARIFLevel(s core.Severity) string
- func SortFindings(fs []core.Finding) []core.Finding
- func Text(w io.Writer, results []Result) error
- type Cell
- type Compliance
- type ComplianceRow
- type Diff
- type Document
- type HTMLOptions
- type Node
- type PrettyOptions
- type Result
Constants ¶
const ( NodeDomain = "domain" NodeHost = "host" NodeService = "service" NodeRoute = "route" )
Node kinds in the attack-surface tree.
Variables ¶
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 Markdown ¶ added in v0.3.2
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 ¶
PrettyDiff writes a diff for the terminal.
func SARIFLevel ¶
SARIFLevel maps a severity to a SARIF result level.
func SortFindings ¶
SortFindings orders findings worst first: severity, confidence, category, title, then fingerprint for stability.
Types ¶
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 ¶
PrettyOptions tune the terminal report.