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 bundle-format default drives the same discovery the old in-process path did: sigstore bundles via referrers when present, legacy .sig tags otherwise (upstreams may still publish those). 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 ¶
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.