Documentation
¶
Overview ¶
Package report converts the raw findings of a completed scan into a scored Report (JSON envelope), a Markdown export, and a SARIF 2.1.0 document.
Index ¶
- Constants
- func Markdown(r *Report) string
- type BuildOptions
- type Counts
- type FindingEntry
- type Report
- type SARIF
- type SARIFArtifactLocation
- type SARIFDriver
- type SARIFInvoc
- type SARIFLoc
- type SARIFPhysicalLocation
- type SARIFResult
- type SARIFRule
- type SARIFRuleConfiguration
- type SARIFRun
- type SARIFText
- type SARIFTool
- type ScanInfo
- type SkippedCheck
- type Summary
Constants ¶
const SchemaVersion = "1.0"
SchemaVersion of the report envelope.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BuildOptions ¶
type BuildOptions struct {
ScannerVersion string
}
BuildOptions parameterises Build.
type Counts ¶
type Counts struct {
Critical int `json:"critical"`
High int `json:"high"`
Medium int `json:"medium"`
Low int `json:"low"`
Info int `json:"info"`
Passed int `json:"passed"`
Skipped int `json:"skipped"`
Errored int `json:"errored"`
}
Counts is the per-status / per-severity breakdown.
type FindingEntry ¶
type FindingEntry struct {
ID string `json:"id"`
Family checks.Family `json:"family"`
Severity checks.Severity `json:"severity"`
Status checks.FindingStatus `json:"status"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Evidence map[string]any `json:"evidence,omitempty"`
Remediation map[string]any `json:"remediation,omitempty"`
IsQuickWin bool `json:"is_quick_win,omitempty"`
}
FindingEntry mirrors checks.Finding but adds `IsQuickWin` derived at build time. Other Finding fields pass through verbatim.
type Report ¶
type Report struct {
SchemaVersion string `json:"schema_version"`
Scan ScanInfo `json:"scan"`
Summary Summary `json:"summary"`
Findings []FindingEntry `json:"findings"`
PassedChecks []string `json:"passed_checks,omitempty"`
SkippedChecks []SkippedCheck `json:"skipped_checks,omitempty"`
}
Report is the persisted JSON shape of a completed scan, wrapping the raw findings with grade / score / counts / quick-wins.
type SARIF ¶
type SARIF struct {
Schema string `json:"$schema"`
Version string `json:"version"`
Runs []SARIFRun `json:"runs"`
}
SARIF is a minimal subset of the SARIF 2.1.0 schema sufficient for GitHub Code Scanning ingestion (oasis-tcs/sarif-spec).
type SARIFArtifactLocation ¶
type SARIFArtifactLocation struct {
URI string `json:"uri"`
}
type SARIFDriver ¶
type SARIFInvoc ¶
type SARIFLoc ¶
type SARIFLoc struct {
PhysicalLocation *SARIFPhysicalLocation `json:"physicalLocation,omitempty"`
}
type SARIFPhysicalLocation ¶
type SARIFPhysicalLocation struct {
ArtifactLocation SARIFArtifactLocation `json:"artifactLocation"`
}
type SARIFResult ¶
type SARIFRule ¶
type SARIFRule struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
ShortDescription SARIFText `json:"shortDescription,omitempty"`
FullDescription SARIFText `json:"fullDescription,omitempty"`
DefaultConfiguration *SARIFRuleConfiguration `json:"defaultConfiguration,omitempty"`
Properties map[string]any `json:"properties,omitempty"`
}
type SARIFRuleConfiguration ¶
type SARIFRuleConfiguration struct {
Level string `json:"level"`
}
type SARIFRun ¶
type SARIFRun struct {
Tool SARIFTool `json:"tool"`
Results []SARIFResult `json:"results"`
Invocations []SARIFInvoc `json:"invocations,omitempty"`
Properties map[string]any `json:"properties,omitempty"`
}
type SARIFTool ¶
type SARIFTool struct {
Driver SARIFDriver `json:"driver"`
}
type ScanInfo ¶
type ScanInfo struct {
ID string `json:"id"`
Target string `json:"target"`
StartedAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at,omitempty"`
DurationSeconds int `json:"duration_seconds"`
ScannerVersion string `json:"scanner_version"`
}
ScanInfo captures the per-scan metadata.
type SkippedCheck ¶
SkippedCheck is the (id, reason) pair surfaced under skipped_checks.
type Summary ¶
type Summary struct {
Grade string `json:"grade"`
Score int `json:"score"`
ScoresPerFamily map[string]int `json:"scores_per_family"`
Counts Counts `json:"counts"`
QuickWins []string `json:"quick_wins"`
}
Summary is the scored top-level overview rendered in Markdown summaries and SARIF run properties.