Documentation
¶
Overview ¶
Package diff implements snapshot comparison: which nodes, edges, and attack paths were added or removed between two graph snapshots, with attribution of what introduced each new path (PRD sections 43-44).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PathKey ¶
type PathKey struct {
Chain string
}
PathKey is the comparable identity of an attack path.
type PathSummary ¶
type PathSummary struct {
SourceID string
TargetID string
NodeChain []string
EdgeTypes []string
Confidence float64
}
PathSummary captures the identity of a path without holding the whole graph: its node chain and edge types.
func Summarize ¶
func Summarize(p *paths.Path) *PathSummary
Key returns the comparable identity of a path.
func (*PathSummary) String ¶
func (s *PathSummary) String() string
String renders a path summary in arrow notation.
type Report ¶
type Report struct {
// AddedNodes are nodes present only in the new snapshot.
AddedNodes []*graph.Node
// RemovedNodes are nodes present only in the old snapshot.
RemovedNodes []*graph.Node
// AddedEdges are edges present only in the new snapshot.
AddedEdges []*graph.Edge
// RemovedEdges are edges present only in the old snapshot.
RemovedEdges []*graph.Edge
// NewPaths are attack paths present only in the new snapshot.
NewPaths []*PathSummary
// GonePaths are attack paths present only in the old snapshot.
GonePaths []*PathSummary
}
Report is the full diff between two snapshots.
func Compute ¶
Compute compares two snapshots. Paths are enumerated from every AI agent with a raised MaxPaths cap: a diff built from truncated path sets could otherwise report spurious new/gone paths. Truncation is surfaced in the returned error when it occurs.
func (*Report) Attribution ¶
func (r *Report) Attribution(p *PathSummary) []*graph.Edge
Attribution explains which structural change most likely introduced a new path: the added edge(s) that the path traverses. Returns the best single edge plus all matching added edges.