Documentation
¶
Overview ¶
Package finding defines the Spackle finding: the schema every stage produces and every report renders, with validation, CVSS 4.0 scoring, deduplication and ranking.
Index ¶
- Constants
- func Classes() []string
- func DefaultVector(class string) (string, bool)
- func LabelRank(label string) int
- func MakeID(class string, loc Location) string
- func Score(vector string) (float64, string, error)
- type BlastRadius
- type ClassInfo
- type Confidence
- type Exploitation
- type Finding
- type Flaw
- type FlowStep
- type Location
- type Proof
- type Remediation
- type Severity
Constants ¶
const ( ConfidenceDemonstrated = "demonstrated" // a proof of concept ran and succeeded ConfidenceHigh = "high" // traced end to end, not run ConfidencePlausible = "plausible" // a lead that was not confirmed )
Confidence levels, from strongest to weakest.
const ( ProofDemonstrated = "demonstrated" // PoC ran in the sandbox and triggered the flaw ProofReasoned = "reasoned" // exploit path argued from code or traffic, not run ProofNotRun = "not-run" // no sandbox, or the operator declined live testing ProofFailed = "failed" // PoC ran and did not trigger the flaw )
Proof statuses.
const ( StatusOpen = "open" StatusDismissed = "dismissed" // refuted by the reviewer; reason kept StatusFixed = "fixed" // a verified patch exists )
Statuses.
const ( SurfaceCode = "code" SurfaceDAST = "running-target" SurfaceInfra = "infrastructure" SurfaceDebug = "debug" )
Surfaces.
Variables ¶
This section is empty.
Functions ¶
func DefaultVector ¶
DefaultVector returns the starting CVSS 4.0 vector for a class, and whether the class is known.
func LabelRank ¶
LabelRank orders severity labels; higher is worse. Unknown labels rank below "none".
Types ¶
type BlastRadius ¶
type BlastRadius struct {
Gains []string `json:"gains,omitempty"`
Exposed []string `json:"exposed,omitempty"`
KillChain string `json:"kill_chain,omitempty"`
Related []string `json:"related,omitempty"` // ids of findings this combines with
}
BlastRadius says what an attacker gains.
type ClassInfo ¶
type ClassInfo struct {
Name string // human name, e.g. "SQL injection"
OWASP []string // OWASP Top 10 2021 category names, exact
Preconditions []string // 1 to 2 items: what an attacker needs
Steps []string // 2 to 4 items: the typical attack chain, defender-level description
ChainsInto []string // 1 to 2 items: what it commonly leads to
Gains []string // 1 to 3 items: what the attacker gets
Fix string // one or two sentences: the specific, standard remediation
}
ClassInfo is general, class-level knowledge used to describe a lead that no model has investigated. Reports label it as typical for the class, not confirmed for the code.
type Confidence ¶
Confidence is the honest label with its reason.
type Exploitation ¶
type Exploitation struct {
Preconditions []string `json:"preconditions,omitempty"`
Steps []string `json:"steps,omitempty"`
ChainsInto []string `json:"chains_into,omitempty"`
}
Exploitation is the attacker's-eye scenario.
type Finding ¶
type Finding struct {
ID string `json:"id"`
Title string `json:"title"`
Surface string `json:"surface"`
Class string `json:"class"`
CWE []string `json:"cwe,omitempty"`
OWASP []string `json:"owasp,omitempty"`
Location Location `json:"location"`
Severity Severity `json:"severity"`
Flaw Flaw `json:"flaw"`
Exploitation Exploitation `json:"exploitation"`
Proof Proof `json:"proof"`
BlastRadius BlastRadius `json:"blast_radius"`
Remediation Remediation `json:"remediation"`
Confidence Confidence `json:"confidence"`
Origin []string `json:"origin,omitempty"`
Status string `json:"status"`
// DismissReason is set when Status is dismissed.
DismissReason string `json:"dismiss_reason,omitempty"`
}
Finding is one reported flaw. Field order here is the order JSON output uses, and the order a report presents the sections in.
func Dedup ¶
Dedup merges findings that share an id, keeping the stronger one and the union of their origins. Input order decides ties.
type Flaw ¶
type Flaw struct {
Description string `json:"description"`
Flow []FlowStep `json:"flow,omitempty"`
}
Flaw describes what is wrong and how data reaches the sink.
type FlowStep ¶
type FlowStep struct {
Role string `json:"role"` // source|propagation|sanitizer|sink
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Quote string `json:"quote,omitempty"`
Note string `json:"note,omitempty"`
}
FlowStep is one hop from source to sink, quoting the real code or traffic.
type Location ¶
type Location struct {
File string `json:"file,omitempty"` // forward-slash path relative to the target root
StartLine int `json:"start_line,omitempty"`
EndLine int `json:"end_line,omitempty"`
Symbol string `json:"symbol,omitempty"`
Method string `json:"method,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Parameter string `json:"parameter,omitempty"`
}
Location says exactly where the flaw is: a file and line range, or an endpoint and parameter. At least one form must be present.
type Proof ¶
type Proof struct {
Status string `json:"status"`
Kind string `json:"kind,omitempty"` // test|script|http-sequence
Summary string `json:"summary,omitempty"`
Artifacts []string `json:"artifacts,omitempty"` // paths relative to the run directory
Command string `json:"command,omitempty"`
Result string `json:"result,omitempty"` // captured output or response excerpt
Isolation string `json:"isolation,omitempty"`
Reason string `json:"reason,omitempty"` // why it was not run, when it was not
}
Proof records the demonstration, or why there is none.
type Remediation ¶
type Remediation struct {
Summary string `json:"summary"`
Patch string `json:"patch,omitempty"` // unified diff
Why string `json:"why,omitempty"`
DefenseInDepth []string `json:"defense_in_depth,omitempty"`
Verification string `json:"verification,omitempty"` // verified|unverified|rejected
Branch string `json:"branch,omitempty"`
}
Remediation is the fix.
type Severity ¶
type Severity struct {
Vector string `json:"cvss_vector,omitempty"`
Score float64 `json:"cvss_score"`
Label string `json:"label"` // critical|high|medium|low|none
Reasoning string `json:"reasoning,omitempty"`
// Unscored is true when no valid vector was available and Label is an
// estimate carried over from a scanner or rule.
Unscored bool `json:"unscored,omitempty"`
}
Severity holds a CVSS 4.0 assessment. Score and Label are always computed by Spackle from Vector; a model never supplies them.
func SeverityFromVector ¶
SeverityFromVector builds a Severity from a vector, computing the score and label.