Documentation
¶
Index ¶
Constants ¶
const ( // Cosign attestation types for supported provenance predicate schemas. CosignAttestationTypeV10 = "slsaprovenance1" CosignAttestationTypeV02 = "slsaprovenance02" )
Variables ¶
This section is empty.
Functions ¶
func ExtractDigestFromImageRef ¶
ExtractDigestFromImageRef returns the sha256 digest component from an image ref.
func ValidateStatementContent ¶
func ValidateStatementContent(content []byte, opts ValidateOptions) error
ValidateStatementContent applies policy checks to a verified provenance payload.
Types ¶
type Attacher ¶
Attacher attaches and verifies provenance attestations via cosign.
func NewAttacher ¶
NewAttacher creates a provenance attacher.
type Format ¶
type Format string
Format identifies the provenance predicate schema.
func DetectFormat ¶
DetectFormat inspects a provenance payload and returns the matching supported format.
func ParseFormat ¶
ParseFormat parses the configured provenance format.
type GenerateOptions ¶
type GenerateOptions struct {
BuilderID string
SourceRoot string
ContextPath string
DockerfilePath string
IncludeGit bool
IncludeDockerfile bool
IncludeEnv bool
IncludeMaterials bool
}
GenerateOptions controls provenance generation.
type Metadata ¶
type Metadata struct {
BuilderID string `json:"builderId,omitempty"`
SourceURI string `json:"sourceUri,omitempty"`
GitCommit string `json:"gitCommit,omitempty"`
GitBranch string `json:"gitBranch,omitempty"`
Dockerfile string `json:"dockerfile,omitempty"`
}
Metadata tracks key provenance metadata used during generation.
type Statement ¶
type Statement struct {
Format Format `json:"format"`
Content []byte `json:"content"`
Digest string `json:"digest"`
ImageRef string `json:"imageRef"`
GeneratedAt time.Time `json:"generatedAt"`
Metadata *Metadata `json:"metadata,omitempty"`
}
Statement holds a generated provenance predicate.
func Generate ¶
func Generate(ctx context.Context, imageRef string, format Format, opts GenerateOptions) (*Statement, error)
Generate creates a provenance predicate for the supplied image.
func NewStatement ¶
NewStatement creates a normalized provenance statement.
func (*Statement) Predicate ¶
Predicate returns the provenance predicate content suitable for cosign attest. When Content is already a bare predicate, it is returned unchanged.
func (*Statement) Validate ¶
func (s *Statement) Validate(opts ValidateOptions) error
Validate verifies that the statement content matches expected provenance policy values.