repocheck

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package repocheck judges the image references found in a repository: it resolves each one (once per distinct reference) and assesses it with registry.Assess. A reference whose images prove no PHP version is not a finding, but it is counted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, rs []refs.Ref, r Resolver, parallel int) ([]Result, Stats)

Check resolves and assesses every reference, with at most parallel references in flight (default 4). Results are in the order of rs. A reference with a literal FROM --platform (Ref.Platform) is judged on that platform only; Result.Resolution is then filtered to it. A global platform restriction is registry.Options.Platforms.

func ErrorKind

func ErrorKind(err error) string

ErrorKind classifies a resolution error: the registry.ErrorKind name, or "timeout" for an expired deadline or cancellation, or "network".

Types

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, ref string) (*registry.Resolution, error)
}

Resolver is what Check needs; *registry.Resolver implements it.

type Result

type Result struct {
	Ref        refs.Ref             `json:"ref"`
	Resolution *registry.Resolution `json:"resolution,omitempty"`
	Assessment registry.Assessment  `json:"assessment"`
	// Error is set when the reference could not be resolved (Assessment is
	// then Unresolved).
	Error string `json:"error,omitempty"`
	// ErrorKind classifies Error: "network", "timeout" and "rate-limited" are
	// transient (registry.Transient); "not-found", "denied", "invalid",
	// "unsupported" and "offline" are definitive.
	ErrorKind string `json:"error_kind,omitempty"`
	// Transient is registry.Transient(ErrorKind): the reference may resolve on
	// a later attempt, so its absence from the findings proves nothing.
	Transient bool `json:"transient,omitempty"`
}

Result is the judgement for one reference.

func (Result) Finding

func (r Result) Finding() bool

Finding reports whether the result is a finding (vulnerable).

type Stats

type Stats struct {
	Refs       int `json:"refs"`
	Images     int `json:"images"` // distinct references resolved
	Vulnerable int `json:"vulnerable"`
	Fixed      int `json:"fixed"`
	Unknown    int `json:"unknown"`
	NoPHP      int `json:"no_php_evidence"`
	NoImages   int `json:"no_images"`
	Unresolved int `json:"unresolved"`
	// Transient counts the unresolved references that failed transiently.
	Transient int `json:"transient"`
}

Stats counts results by verdict.

Jump to

Keyboard shortcuts

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