Documentation
¶
Index ¶
- type ChangeDetail
- type ChangeType
- type Config
- type CriticalChange
- type CriticalityRule
- type Differ
- type PathIgnorer
- type Result
- func (r *Result) ExportCSV() [][]string
- func (r *Result) FilterChanges(filter func(path string, changeType ChangeType) bool) *Result
- func (r *Result) GetChangesByType() map[ChangeType][]string
- func (r *Result) GetCriticalChanges() []CriticalChange
- func (r *Result) GetCriticalChangesByCategory(category string) []CriticalChange
- func (r *Result) GetCriticalChangesBySeverity(minSeverity int) []CriticalChange
- func (r *Result) GetSecurityCriticalChanges() []CriticalChange
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeDetail ¶
type ChangeDetail struct {
OldRecord *snapshot.FileRecord `json:"old_record"`
NewRecord *snapshot.FileRecord `json:"new_record"`
Changes []string `json:"changes"`
}
ChangeDetail represents details about a modified file
type ChangeType ¶
type ChangeType string
ChangeType represents the type of change
const ( ChangeAdded ChangeType = "added" ChangeModified ChangeType = "modified" ChangeDeleted ChangeType = "deleted" )
type CriticalChange ¶
type CriticalChange struct {
Record *snapshot.FileRecord `json:"record"`
Path string `json:"path"`
Type ChangeType `json:"type"`
Reason string `json:"reason"`
Category string `json:"category"`
Severity int `json:"severity"` // 1-10 scale
}
CriticalChange represents a security-relevant change
type CriticalityRule ¶
type CriticalityRule struct {
Matcher func(path string) bool
Severity map[ChangeType]int
Name string
Category string
Description string
}
CriticalityRule defines how to detect and score critical changes
func GetCriticalityRules ¶
func GetCriticalityRules() []CriticalityRule
GetCriticalityRules returns all hardcoded criticality rules Edit this function to add/modify/remove rules
type Differ ¶
type Differ struct {
// contains filtered or unexported fields
}
Differ handles comparing snapshots
type PathIgnorer ¶
type PathIgnorer struct {
// contains filtered or unexported fields
}
PathIgnorer handles ignore pattern matching for diffs
func (*PathIgnorer) ShouldIgnore ¶
func (i *PathIgnorer) ShouldIgnore(path string) bool
ShouldIgnore checks if a path should be ignored during diff
type Result ¶
type Result struct {
Generated time.Time `json:"generated"`
Baseline *snapshot.Snapshot `json:"baseline"`
Current *snapshot.Snapshot `json:"current"`
Added map[string]*snapshot.FileRecord `json:"added"`
Modified map[string]*ChangeDetail `json:"modified"`
Deleted map[string]*snapshot.FileRecord `json:"deleted"`
Summary Summary `json:"summary"`
}
Result represents the comparison between two snapshots
func (*Result) FilterChanges ¶
func (r *Result) FilterChanges(filter func(path string, changeType ChangeType) bool) *Result
FilterChanges filters the diff result based on criteria
func (*Result) GetChangesByType ¶
func (r *Result) GetChangesByType() map[ChangeType][]string
GetChangesByType returns changes grouped by type
func (*Result) GetCriticalChanges ¶
func (r *Result) GetCriticalChanges() []CriticalChange
GetCriticalChanges analyzes a diff result for critical changes
func (*Result) GetCriticalChangesByCategory ¶
func (r *Result) GetCriticalChangesByCategory(category string) []CriticalChange
GetCriticalChangesByCategory returns critical changes filtered by category
func (*Result) GetCriticalChangesBySeverity ¶
func (r *Result) GetCriticalChangesBySeverity(minSeverity int) []CriticalChange
GetCriticalChangesBySeverity returns critical changes above a minimum severity
func (*Result) GetSecurityCriticalChanges ¶
func (r *Result) GetSecurityCriticalChanges() []CriticalChange
GetSecurityCriticalChanges returns only security-related critical changes
type Summary ¶
type Summary struct {
AddedCount int `json:"added_count"`
ModifiedCount int `json:"modified_count"`
DeletedCount int `json:"deleted_count"`
TotalChanges int `json:"total_changes"`
AddedSize int64 `json:"added_size"`
DeletedSize int64 `json:"deleted_size"`
SizeDiff int64 `json:"size_diff"`
ComparisonTime time.Duration `json:"comparison_time"`
}
Summary contains summary statistics