Documentation
¶
Overview ¶
Package risk: probabilistic attack-path likelihood (PRD section 68, "probabilistic attack paths").
Reachability says a path *can* be walked. Likelihood estimates how *plausibly* an attacker walks it. Each edge gets an exploitation probability derived from its security cost; the path's likelihood is the product of its edges' probabilities.
Package risk implements explainable attack-path risk scoring (PRD sections 13 and 14).
Index ¶
- Constants
- func EdgeLikelihood(e *graph.Edge) float64
- func ExpectedThreat(score int, likelihood float64) int
- func LikelihoodFor(p float64) string
- func LikelihoodRank(band string) int
- func PathLikelihood(edges []*graph.Edge) float64
- func SeverityFor(score int) string
- func SeverityRank(s string) int
- func SortFactors(fs []Factor)
- type Factor
- type Result
Constants ¶
const ( LikelihoodVeryLikely = "VERY_LIKELY" LikelihoodLikely = "LIKELY" LikelihoodPossible = "POSSIBLE" LikelihoodUnlikely = "UNLIKELY" LikelihoodImplausible = "IMPLAUSIBLE" )
Likelihood thresholds for reporting bands.
const ( SeverityInformational = "INFORMATIONAL" SeverityLow = "LOW" SeverityMedium = "MEDIUM" SeverityHigh = "HIGH" SeverityCritical = "CRITICAL" )
Severity bands (PRD section 13).
Variables ¶
This section is empty.
Functions ¶
func EdgeLikelihood ¶ added in v0.6.0
EdgeLikelihood estimates the probability that an attacker can traverse a single edge, given they reached its source.
Inputs:
- e.EffectiveRisk(): how privileged/dangerous the relationship is (higher risk = easier or more valuable traversal)
- e.Confidence: how certain we are the relationship exists at all
- metadata override: an explicit likelihood from configuration
The base probability treats effective risk as ease of abuse (risk 100 -> 0.90, risk 0 -> 0.10) and multiplies by confidence so speculative relationships attenuate likelihood. Configured overrides win outright.
func ExpectedThreat ¶ added in v0.6.0
ExpectedThreat combines likelihood with the deterministic risk score: the product estimates how much of the path's damage is realistically expected. Used to order paths that share a target.
func LikelihoodFor ¶ added in v0.6.0
LikelihoodFor maps a probability to its reporting band.
func LikelihoodRank ¶ added in v0.6.0
LikelihoodRank returns an ordinal for comparing bands.
func PathLikelihood ¶ added in v0.6.0
PathLikelihood returns the probability that an attacker traverses the full path in one attempt, assuming independence between edges. Long paths attenuate quickly, which is the point: an 8-hop chain of 0.5-probability hops is ~0.4% likely even when every hop alone is feasible.
func SeverityFor ¶
SeverityFor maps a 0-100 score to its severity band.
func SeverityRank ¶
SeverityRank returns an ordinal for comparing severities.
func SortFactors ¶
func SortFactors(fs []Factor)
SortFactors orders a factor breakdown from largest positive contribution to largest penalty, for readable explanations.
Types ¶
type Factor ¶
type Factor struct {
Name string `json:"name"`
Delta int `json:"delta"`
Reason string `json:"reason"`
}
Factor is one explainable contribution to a risk score.