verification

package
v1.220.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyWhenAvailable = "when_available"
	PolicyRequired      = "required"
	PolicyDisabled      = "disabled"

	VerifierInstallAuto     = "auto"
	VerifierInstallPathOnly = "path_only"
)

Variables

View Source
var (
	ErrChecksumRequired        = errors.New("checksum verification required")
	ErrChecksumMismatch        = errors.New("checksum mismatch")
	ErrChecksumNotFound        = errors.New("checksum not found")
	ErrChecksumAmbiguous       = errors.New("ambiguous checksum entries for asset")
	ErrDownloadFailed          = errors.New("verification sidecar download failed")
	ErrUnsupportedAlgorithm    = errors.New("unsupported checksum algorithm")
	ErrSignatureRequired       = errors.New("signature verification required")
	ErrSignatureFailed         = errors.New("signature verification failed")
	ErrVerifierCommandRequired = errors.New("verifier command required")
)

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, name string, args ...string) error
}

CommandRunner runs external verification commands.

type Downloader

type Downloader interface {
	Download(ctx context.Context, url string) ([]byte, error)
}

Downloader fetches verification sidecar files such as checksum files and signatures.

type ExecRunner

type ExecRunner struct{}

ExecRunner runs verifier commands from PATH.

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, name string, args ...string) error

Run executes a verifier command.

type HTTPDownloader

type HTTPDownloader struct {
	Client *http.Client
}

HTTPDownloader downloads sidecar files using an HTTP client.

func (HTTPDownloader) Download

func (d HTTPDownloader) Download(ctx context.Context, url string) ([]byte, error)

Download fetches a URL and returns its response body.

type Policy

type Policy struct {
	Checksums       string
	Signatures      string
	VerifierInstall string
}

Policy controls verification behavior.

func PolicyFromConfig

func PolicyFromConfig(config *schema.ToolchainVerification) Policy

PolicyFromConfig returns a fully defaulted verification policy.

type Request

type Request struct {
	Tool       *registry.Tool
	Version    string
	AssetURL   string
	AssetPath  string
	Policy     Policy
	Downloader Downloader
	Runner     CommandRunner
}

Request contains all data required to verify a downloaded tool asset.

type Result

type Result struct {
	AssetSize         int64
	ChecksumAlgorithm string
	Checksum          string
	SignatureMethods  []string
	SkippedReasons    []string
}

Result describes verification that was performed or skipped.

type Verifier

type Verifier struct {
	Downloader Downloader
	Runner     CommandRunner
}

Verifier verifies downloaded tool assets.

func (*Verifier) Verify

func (v *Verifier) Verify(ctx context.Context, req Request) (*Result, error)

Verify verifies a downloaded asset according to request policy.

Jump to

Keyboard shortcuts

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