Documentation
¶
Overview ¶
Package imageaudit reports image hygiene across the fleet: digest pinning, latest-tag usage, distinct image counts, and optional registry probes for age and signature checks.
Index ¶
Constants ¶
const Name = "image-audit"
Name is the registry key for this scanner.
Variables ¶
This section is empty.
Functions ¶
func NewScanner ¶
NewScanner returns a scanner that audits container image references.
func ProbeRegistriesEnabled ¶
func ProbeRegistriesEnabled() bool
ProbeRegistriesEnabled reports the current toggle state.
func SetProbeRegistries ¶
func SetProbeRegistries(enabled bool)
SetProbeRegistries toggles the registry-probe path. Off by default. Callers set it once at startup from a flag value.
Types ¶
type Data ¶
type Data struct {
// TotalContainers is the number of containers scanned.
TotalContainers int `json:"total_containers"`
// LatestTag is containers using the :latest tag or no tag.
LatestTag int `json:"latest_tag"`
// NoDigest is containers without a digest pin (@sha256:...).
NoDigest int `json:"no_digest"`
// UniqueImages is the number of distinct image references.
UniqueImages int `json:"unique_images"`
// ImageRisks lists containers with image hygiene concerns.
ImageRisks []ImageRisk `json:"image_risks"`
// ImagesProbed is the number of unique images successfully resolved
// against their registry. Zero when --probe-registries is off.
ImagesProbed int `json:"images_probed"`
// ImagesFailed is the number of probe attempts that errored.
ImagesFailed int `json:"images_failed"`
// OldestImageAgeDays is the age of the oldest successfully-probed image
// expressed in days since its registry-reported creation time.
OldestImageAgeDays int `json:"oldest_image_age_days"`
// AvgImageAgeDays is the mean age across all probed images.
AvgImageAgeDays int `json:"avg_image_age_days"`
}
Data holds image audit results for one cluster.
type ImageRisk ¶
type ImageRisk struct {
// Namespace is the pod's namespace.
Namespace string `json:"namespace"`
// Pod is the pod name.
Pod string `json:"pod"`
// Container is the container name.
Container string `json:"container"`
// Image is the full image reference.
Image string `json:"image"`
// Risks lists the specific concerns.
Risks []string `json:"risks"`
}
ImageRisk describes a container image with a hygiene concern.
type ProbeResult ¶
type ProbeResult struct {
// Image is the resolved reference (canonical form).
Image string
// CreatedAt is the manifest's reported creation time. Zero when the
// registry did not return a Created field on the config blob.
CreatedAt time.Time
// Err is the error encountered, if any.
Err error
}
ProbeResult captures the outcome of resolving one image manifest. Used internally; the aggregated counts surface on Data.