validate

package
v0.8.77 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultWorkers         = 5
	DefaultVSAExpiration   = "168h" // 7 days
	DefaultEffectiveTime   = "now"
	DefaultStrictMode      = true
	DefaultFallbackEnabled = true
	DefaultTimeoutDuration = 30 * time.Minute
)

Constants for default values

Variables

View Source
var ValidateCmd *cobra.Command

Functions

func NewValidateCmd

func NewValidateCmd() *cobra.Command

func NewValidateVSACmd added in v0.8.39

func NewValidateVSACmd() *cobra.Command

func ValidatePolicyCmd

func ValidatePolicyCmd(validate policyValidationFunc) *cobra.Command

Types

type AllSectionsData added in v0.8.73

type AllSectionsData struct {
	// Result section data
	OverallPassed bool
	FallbackUsed  bool
	FallbackCount int
	TotalImages   int
	ImageStatuses []ImageStatus

	// VSA Summary data
	SignatureStatus  string
	PredicatePassed  int
	PredicateFailed  int
	PolicyMatches    int
	PolicyMismatches int
	PolicyDiffCounts map[string]PolicyDiffCounts // keyed by short digest
	FallbackReasons  map[string]bool             // deduplicated reasons

	// Policy Diff data
	HasPolicyDiff  bool
	AffectedImages []string

	// Final Summary data
	VSAPassed       int
	VSAFailed       int
	FallbackPassed  int
	FallbackFailed  int
	FallbackNotUsed int

	// Fallback results (already processed, no re-processing needed)
	FallbackResults []validate_utils.Result
}

AllSectionsData - Aggregated data for all sections in one structure Collected in a single pass for efficiency

type ComponentResultsDisplay added in v0.8.73

type ComponentResultsDisplay struct {
	Header     HeaderDisplay
	Result     ResultDisplay
	VSASummary VSASummaryDisplay
	PolicyDiff *PolicyDiffDisplay // nil if no policy diff

}

ComponentResultsDisplay holds all formatted display data for component results

func (ComponentResultsDisplay) WriteAll added in v0.8.73

func (d ComponentResultsDisplay) WriteAll(outputFormats []string, fs afero.Fs, cmd *cobra.Command) error

WriteAll writes ComponentResultsDisplay to all specified output formats

type HeaderDisplay added in v0.8.73

type HeaderDisplay struct {
	Title     string
	Timestamp string
}

HeaderDisplay holds the formatted header section data

func (HeaderDisplay) String added in v0.8.73

func (h HeaderDisplay) String() string

String formats the header for display

type HeaderReport added in v0.8.73

type HeaderReport struct {
	Title     string `json:"title" yaml:"title"`
	Timestamp string `json:"timestamp" yaml:"timestamp"`
}

HeaderReport is the serializable version of HeaderDisplay

type ImageStatus added in v0.8.73

type ImageStatus struct {
	Index          int
	Digest         string // Shortened digest
	VSAStatus      string // "PASSED" or "FAILED(reason=...)"
	FallbackStatus string // "PASSED", "FAILED", or ""
}

Data structures for aggregated section data

type InputValidationFunc

type InputValidationFunc func(context.Context, string, policy.Policy, bool) (*output.Output, error)

type PolicyDiffCounts added in v0.8.73

type PolicyDiffCounts struct {
	Added   int
	Removed int
	Changed int
}

type PolicyDiffDisplay added in v0.8.73

type PolicyDiffDisplay struct {
	AffectedImages string // Comma-separated list of affected images
	Added          string // "none" or "[include] N"
	Removed        string // "none" or "N"
	Changed        string // "none" or "N"
}

PolicyDiffDisplay holds the formatted Policy Diff section data

func (PolicyDiffDisplay) String added in v0.8.73

func (p PolicyDiffDisplay) String() string

String formats the Policy Diff section for display

type PolicyDiffReport added in v0.8.73

type PolicyDiffReport struct {
	AffectedImages string `json:"affected_images" yaml:"affected_images"`
	Added          string `json:"added" yaml:"added"`
	Removed        string `json:"removed" yaml:"removed"`
	Changed        string `json:"changed" yaml:"changed"`
}

PolicyDiffReport is the serializable version of PolicyDiffDisplay

type ResultDisplay added in v0.8.73

type ResultDisplay struct {
	Overall    string // "✅ PASSED" or "❌ FAILED"
	Fallback   string // "used for all images", "used for some images", or ""
	ImageCount int
	ImageLines []string // Formatted image status lines
}

ResultDisplay holds the formatted Result section data

func (ResultDisplay) String added in v0.8.73

func (r ResultDisplay) String() string

String formats the Result section for display

type ResultReport added in v0.8.73

type ResultReport struct {
	Overall    string   `json:"overall" yaml:"overall"`
	Fallback   string   `json:"fallback,omitempty" yaml:"fallback,omitempty"`
	ImageCount int      `json:"image_count" yaml:"image_count"`
	Images     []string `json:"images" yaml:"images"`
}

ResultReport is the serializable version of ResultDisplay

type ResultType added in v0.8.44

type ResultType int

ResultType represents the classification of a component validation result

const (
	ResultTypeError ResultType = iota
	ResultTypeFallback
	ResultTypeVSASuccess
	ResultTypeVSAFailure
	ResultTypeUnexpected
)

type VSAReport added in v0.8.44

type VSAReport struct {
	Header     HeaderReport                `json:"header" yaml:"header"`
	Result     ResultReport                `json:"result" yaml:"result"`
	VSASummary VSASummaryReport            `json:"vsa_summary" yaml:"vsa_summary"`
	PolicyDiff *PolicyDiffReport           `json:"policy_diff,omitempty" yaml:"policy_diff,omitempty"`
	Fallback   *applicationsnapshot.Report `json:"fallback,omitempty" yaml:"fallback,omitempty"`
}

VSAReport holds the combined VSA sections and fallback report VSA sections are at the root level, with fallback as an additional field

type VSASectionsReport added in v0.8.73

type VSASectionsReport struct {
	Header     HeaderReport      `json:"header" yaml:"header"`
	Result     ResultReport      `json:"result" yaml:"result"`
	VSASummary VSASummaryReport  `json:"vsa_summary" yaml:"vsa_summary"`
	PolicyDiff *PolicyDiffReport `json:"policy_diff,omitempty" yaml:"policy_diff,omitempty"`
}

VSASectionsReport holds the structured data for VSA sections that can be serialized

type VSASummaryDisplay added in v0.8.73

type VSASummaryDisplay struct {
	Signature       string // Signature status
	Predicate       string // Predicate status line
	Policy          string // Policy status line
	FallbackReasons string // Fallback reason(s) line, or ""
}

VSASummaryDisplay holds the formatted VSA Summary section data

func (VSASummaryDisplay) String added in v0.8.73

func (v VSASummaryDisplay) String() string

String formats the VSA Summary section for display

type VSASummaryReport added in v0.8.73

type VSASummaryReport struct {
	Signature       string `json:"signature" yaml:"signature"`
	Predicate       string `json:"predicate" yaml:"predicate"`
	Policy          string `json:"policy" yaml:"policy"`
	FallbackReasons string `json:"fallback_reasons,omitempty" yaml:"fallback_reasons,omitempty"`
}

VSASummaryReport is the serializable version of VSASummaryDisplay

Jump to

Keyboard shortcuts

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