Documentation
¶
Overview ¶
Package sign signs published OCI artifacts: keylessly (ambient OIDC — the CI workflow's identity — through Fulcio, with a public transparency log entry) or with a cloud KMS key (gcpkms://, awskms://, azurekms://). Signatures are stored as sigstore bundles attached via the OCI referrers API — never legacy .sig tags — the format policy engines' bundle rules and modern consumers verify.
Signing shells out to the cosign binary (>= v3) with a generated sigstore signing config, the only service channel that is not deprecated; KMS URI schemes are whatever that cosign build supports. A signer for tests can point at a local cosign keypair instead.
Ensurer is the verify-then-sign step mirror sync and build share: a reference that already verifies under the resolved signing config is left alone, so publishing stays idempotent across re-runs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactSigner ¶ added in v0.12.0
ArtifactSigner signs one OCI artifact reference. *Signer satisfies it; tests inject key-file or recording signers.
type Ensurer ¶ added in v0.12.0
type Ensurer struct {
// Verify checks one signature subject (the cosign-backed verifier in
// production; key-based in tests).
Verify func(context.Context, verify.Subject) error
// NewSigner builds a signer for a resolved signing config.
NewSigner func(*spec.Signing) (ArtifactSigner, error)
}
Ensurer is the verify-then-sign step every publisher runs after a push: a reference already carrying a valid signature for the resolved signing config is left alone, anything else is signed. Both seams are required.
func (Ensurer) Ensure ¶ added in v0.12.0
func (e Ensurer) Ensure(ctx context.Context, ref string, signing *spec.Signing, recursive bool) (bool, error)
Ensure signs ref unless it already carries a valid signature under signing, reporting whether a signature was created. recursive also signs a manifest list's children.
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer signs OCI artifacts per one resolved signing config by shelling out to the cosign binary. KMS URI schemes (awskms:// gcpkms:// azurekms:// hashivault://) are whatever the installed cosign build supports — upstream release binaries include all of them.
func New ¶
func New(signing *spec.Signing, runner ToolRunner) (*Signer, error)
New builds a signer for a resolved signing config.
func NewWithKeyFile ¶
func NewWithKeyFile(keyPath string, password []byte, runner ToolRunner) *Signer
NewWithKeyFile builds a test signer over a local cosign keypair, offline (no transparency log, plain-HTTP registries allowed).
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.