verify

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package verify checks OCI artifact signatures for the mirror: upstream provenance per a manifest's verifyUpstream rules (keyless with an identity regexp, or a published public key), and the mirror's own signatures (the exact certificate identity or KMS key it signs with — the publish-idempotency self-check).

Verification drives the same code paths the cosign CLI drives: sigstore bundles attached via OCI referrers are discovered first, with fallback to legacy .sig tags, and a rule may point at a dedicated signature repository for publishers that store signatures away from the artifact. Keyless verification fetches the public trust roots (TUF); key-based verification is offline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(ctx context.Context, runner ToolRunner, s Subject) error

Verify checks the subject by shelling out to the cosign binary, whose default --new-bundle-format=true drives the same discovery the old in-process path did: sigstore bundles via referrers when present, legacy .sig tags otherwise. The CLI additionally checks claims (--check-claims defaults true) — strictly stronger than the previous nil ClaimVerifier, and desirable.

Types

type Subject

type Subject struct {
	// Ref is the artifact to verify (tag or digest reference).
	Ref string

	// KeyRef verifies against a public key (a path, URL or KMS URI);
	// empty means keyless.
	KeyRef string
	// HashAlgorithm overrides the payload digest for key verification
	// ("", "sha256", "sha384" or "sha512" — some publishers sign with
	// sha512).
	HashAlgorithm string
	// IdentityRegexp matches the certificate identity for keyless
	// verification (mutually exclusive with Identity).
	IdentityRegexp string
	// Identity pins the exact certificate identity (the mirror's own
	// signatures).
	Identity string
	// Issuer is the OIDC issuer for keyless verification.
	Issuer string
	// SignatureRepository reads signatures from a dedicated repository
	// instead of alongside the artifact.
	SignatureRepository string
	// IgnoreTlog skips transparency-log verification (key-based rules
	// and offline self-checks).
	IgnoreTlog bool
	// AllowHTTPRegistry permits plain-HTTP registries (tests, local
	// mirrors).
	AllowHTTPRegistry bool
}

Subject is one verification: what to check and against which trust.

func MirrorSubject

func MirrorSubject(ref string, signing *spec.Signing) (Subject, error)

MirrorSubject translates the mirror's own signing config into the self-verification for ref: the exact identity keyless signing produces, or the KMS key's public half.

func UpstreamSubject

func UpstreamSubject(ref string, rule spec.VerifyRule) (Subject, error)

UpstreamSubject translates a manifest verifyUpstream rule for ref. Provider none is the caller's business — it is a documented gap, never a verification.

type ToolRunner added in v0.11.0

type ToolRunner interface {
	// Run executes name with args and extra environment, returning stdout.
	Run(ctx context.Context, name string, args, env []string) (stdout []byte, err error)
	// Look reports whether the binary is available.
	Look(name string) bool
}

ToolRunner executes the cosign binary; a seam so tests can can its invocations. scan.ExecRunner satisfies it.

Jump to

Keyboard shortcuts

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