state

package
v1.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScanStatusUnknown     = "unknown"
	ScanStatusRunning     = "running"
	ScanStatusCompleted   = "completed"
	ScanStatusInterrupted = "interrupted"
	ScanStatusFailed      = "failed"
)
View Source
const ApprovalInventoryVersion = "1"
View Source
const ScanStatusVersion = "1"
View Source
const SnapshotVersion = "v1"

Variables

This section is empty.

Functions

func HasIncompleteSource added in v1.8.0

func HasIncompleteSource(snapshot Snapshot) bool

func IncompleteSourceError added in v1.8.0

func IncompleteSourceError(path string, snapshot Snapshot) error

func IncompleteSourceReasons added in v1.8.0

func IncompleteSourceReasons(snapshot Snapshot) []string

func ResolvePath

func ResolvePath(explicit string) string

func Save

func Save(path string, snapshot Snapshot) error

func SaveScanStatus added in v1.2.0

func SaveScanStatus(statePath string, status ScanStatus) error

func ScanStatusPath added in v1.2.0

func ScanStatusPath(statePath string) string

Types

type PhaseTiming added in v1.2.0

type PhaseTiming struct {
	Phase          string `json:"phase"`
	StartedAt      string `json:"started_at,omitempty"`
	CompletedAt    string `json:"completed_at,omitempty"`
	DurationMillis int64  `json:"duration_ms,omitempty"`
}

type ScanDetectorProgress added in v1.4.0

type ScanDetectorProgress struct {
	Total          int    `json:"total,omitempty"`
	Completed      int    `json:"completed,omitempty"`
	Failed         int    `json:"failed,omitempty"`
	Pending        int    `json:"pending,omitempty"`
	ActiveDetector string `json:"active_detector,omitempty"`
}

type ScanHeapReceipt added in v1.9.0

type ScanHeapReceipt struct {
	AllocBytes   uint64 `json:"alloc_bytes,omitempty"`
	HeapObjects  uint64 `json:"heap_objects,omitempty"`
	HeapSysBytes uint64 `json:"heap_sys_bytes,omitempty"`
	NextGCBytes  uint64 `json:"next_gc_bytes,omitempty"`
	NumGC        uint32 `json:"num_gc,omitempty"`
}

type ScanPhaseProgress added in v1.4.0

type ScanPhaseProgress struct {
	Phase         string           `json:"phase,omitempty"`
	Percent       int              `json:"percent,omitempty"`
	Subphase      string           `json:"subphase,omitempty"`
	SubphaseStep  int              `json:"subphase_step,omitempty"`
	SubphaseTotal int              `json:"subphase_total,omitempty"`
	HeapReceipt   *ScanHeapReceipt `json:"heap_receipt,omitempty"`
}

type ScanRepoProgress added in v1.4.0

type ScanRepoProgress struct {
	Total     int `json:"total,omitempty"`
	Succeeded int `json:"succeeded,omitempty"`
	Completed int `json:"completed,omitempty"`
	Failed    int `json:"failed,omitempty"`
	Pending   int `json:"pending,omitempty"`
}

type ScanStatus added in v1.2.0

type ScanStatus struct {
	ScanStatusVersion   string                  `json:"scan_status_version"`
	Status              string                  `json:"status"`
	StatePath           string                  `json:"state_path"`
	Target              any                     `json:"target,omitempty"`
	Targets             any                     `json:"targets,omitempty"`
	CurrentPhase        string                  `json:"current_phase,omitempty"`
	LastSuccessfulPhase string                  `json:"last_successful_phase,omitempty"`
	RepoTotal           int                     `json:"repo_total,omitempty"`
	ReposCompleted      int                     `json:"repos_completed,omitempty"`
	ReposSucceeded      int                     `json:"repos_succeeded,omitempty"`
	ReposFailed         int                     `json:"repos_failed,omitempty"`
	ProgressPercent     int                     `json:"progress_percent,omitempty"`
	ProgressMessage     string                  `json:"progress_message,omitempty"`
	LastProgressAt      string                  `json:"last_progress_at,omitempty"`
	ElapsedSeconds      int64                   `json:"elapsed_seconds,omitempty"`
	PhaseProgress       *ScanPhaseProgress      `json:"phase_progress,omitempty"`
	RepoProgress        *ScanRepoProgress       `json:"repo_progress,omitempty"`
	DetectorProgress    *ScanDetectorProgress   `json:"detector_progress,omitempty"`
	PartialResult       bool                    `json:"partial_result,omitempty"`
	PartialResultMarker string                  `json:"partial_result_marker,omitempty"`
	StartedAt           string                  `json:"started_at,omitempty"`
	UpdatedAt           string                  `json:"updated_at,omitempty"`
	CompletedAt         string                  `json:"completed_at,omitempty"`
	Error               string                  `json:"error,omitempty"`
	ArtifactPaths       map[string]string       `json:"artifact_paths,omitempty"`
	PhaseTimings        []PhaseTiming           `json:"phase_timings,omitempty"`
	SourcePrivacy       *sourceprivacy.Contract `json:"source_privacy,omitempty"`
	LikelyInterrupted   bool                    `json:"likely_interrupted,omitempty"`
	DiagnosticReason    string                  `json:"diagnostic_reason,omitempty"`
	DiagnosticNextSteps []string                `json:"diagnostic_next_steps,omitempty"`
}

func LoadScanStatus added in v1.2.0

func LoadScanStatus(statePath string) (ScanStatus, error)

type ScoreView added in v1.1.2

type ScoreView struct {
	Findings        []source.Finding
	PolicyOutcomes  []outputsignal.PolicyOutcome
	PostureScore    *score.Result
	Identities      []manifest.IdentityRecord
	TransitionCount int
	AttackPaths     []riskattack.ScoredPath
	TopAttackPaths  []riskattack.ScoredPath
	HasRiskReport   bool
}

func LoadScoreView added in v1.1.2

func LoadScoreView(path string) (ScoreView, error)

LoadScoreView validates the stored scan snapshot shape needed by the score command without fully materializing large unused report sections on the cached-score path.

type Snapshot

type Snapshot struct {
	Version                    string                         `json:"version"`
	ApprovalInventoryVersion   string                         `json:"approval_inventory_version,omitempty"`
	Target                     source.Target                  `json:"target"`
	Targets                    []source.Target                `json:"targets,omitempty"`
	Findings                   []source.Finding               `json:"findings"`
	PolicyOutcomes             []outputsignal.PolicyOutcome   `json:"policy_outcomes,omitempty"`
	Inventory                  *agginventory.Inventory        `json:"inventory,omitempty"`
	ControlBacklog             *controlbacklog.Backlog        `json:"control_backlog,omitempty"`
	LifecycleGaps              []lifecycle.Gap                `json:"lifecycle_gaps,omitempty"`
	ScanQuality                *scanquality.Report            `json:"scan_quality,omitempty"`
	ScanMode                   string                         `json:"scan_mode,omitempty"`
	PartialResult              bool                           `json:"partial_result,omitempty"`
	SourceErrors               []source.RepoFailure           `json:"source_errors,omitempty"`
	SourceDegraded             bool                           `json:"source_degraded,omitempty"`
	RiskReport                 *risk.Report                   `json:"risk_report,omitempty"`
	SuppressedCounts           *outputsignal.SuppressedCounts `json:"suppressed_counts,omitempty"`
	Profile                    *profileeval.Result            `json:"profile,omitempty"`
	PostureScore               *score.Result                  `json:"posture_score,omitempty"`
	Identities                 []manifest.IdentityRecord      `json:"identities,omitempty"`
	Transitions                []lifecycle.Transition         `json:"lifecycle_transitions,omitempty"`
	SourcePrivacy              *sourceprivacy.Contract        `json:"source_privacy,omitempty"`
	PublicEvidenceManifestName string                         `json:"public_evidence_manifest_name,omitempty"`
	PublicEvidence             []source.PublicEvidence        `json:"public_evidence,omitempty"`
}

Snapshot stores deterministic scan material for diff mode.

func FinalizeSnapshotForOutput added in v1.8.0

func FinalizeSnapshotForOutput(snapshot Snapshot) Snapshot

func Load

func Load(path string) (Snapshot, error)

func LoadRaw added in v1.1.1

func LoadRaw(path string) (Snapshot, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL