Help us shape the future of Go! Take the 2026 Go Developer Survey

chainloop

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AnnotationMaterialName = "chainloop.material.name"
View Source
const AnnotationMaterialType = "chainloop.material.type"
View Source
const PredicateTypeV01 = "chainloop.dev/attestation/v0.1"
View Source
const PredicateTypeV02 = "chainloop.dev/attestation/v0.2"

Replace custom material type with https://github.com/in-toto/attestation/blob/main/spec/v1.0/resource_descriptor.md

Variables

This section is empty.

Functions

func ExtractStatement

func ExtractStatement(envelope *dsse.Envelope) (*in_toto.Statement, error)

Types

type Maintainer

type Maintainer struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type Metadata

type Metadata struct {
	Name          string     `json:"name"`
	Project       string     `json:"project"`
	Team          string     `json:"team"`
	InitializedAt *time.Time `json:"initializedAt"`
	FinishedAt    *time.Time `json:"finishedAt"`
	WorkflowRunID string     `json:"workflowRunID"`
	WorkflowID    string     `json:"workflowID"`
}

type NormalizablePredicate

type NormalizablePredicate interface {
	GetEnvVars() map[string]string
	GetMaterials() []*NormalizedMaterial
}

NormalizablePredicate represents a common interface of how to extract materials and env vars

func ExtractPredicate

func ExtractPredicate(envelope *dsse.Envelope) (NormalizablePredicate, error)

Extract the Chainloop attestation predicate from an encoded DSSE envelope NOTE: We return a NormalizablePredicate interface to allow for future versions of the predicate to be extracted without updating the consumer. Yes, having the producer define and return an interface is an anti-pattern. but it greatly simplifies the code since there are multiple consumers at different layers of the app and we expect predicates to evolve quickly

type NormalizedMaterial

type NormalizedMaterial struct {
	// Name of the Material
	Name string
	// Type of the Material
	Type string
	// Either the fileName or the actual string content
	Value string
	// Hash of the Material
	Hash *crv1.Hash
}

type ProvenanceM

type ProvenanceM struct {
	SLSA      *SLSACommonProvenanceMaterial `json:"slsa,omitempty"`
	StringVal string                        `json:"stringVal,omitempty"`
}

type ProvenanceMaterial

type ProvenanceMaterial struct {
	Name     string       `json:"name"`
	Type     string       `json:"type"`
	Material *ProvenanceM `json:"material"`
}

type ProvenancePredicateCommon

type ProvenancePredicateCommon struct {
	Metadata   *Metadata                     `json:"metadata"`
	Builder    *slsacommon.ProvenanceBuilder `json:"builder"`
	BuildType  string                        `json:"buildType"`
	Env        map[string]string             `json:"env,omitempty"`
	RunnerType string                        `json:"runnerType"`
	RunnerURL  string                        `json:"runnerURL,omitempty"`
}

func (*ProvenancePredicateCommon) GetEnvVars

func (p *ProvenancePredicateCommon) GetEnvVars() map[string]string

Implement NormalizablePredicate interface

type ProvenancePredicateV01

type ProvenancePredicateV01 struct {
	*ProvenancePredicateCommon
	Materials []*ProvenanceMaterial `json:"materials,omitempty"`
}

func (*ProvenancePredicateV01) GetMaterials

func (p *ProvenancePredicateV01) GetMaterials() []*NormalizedMaterial

Implement NormalizablePredicate Override

type ProvenancePredicateV02

type ProvenancePredicateV02 struct {
	*ProvenancePredicateCommon
	Materials []*slsa_v1.ResourceDescriptor `json:"materials,omitempty"`
}

func (*ProvenancePredicateV02) GetMaterials

func (p *ProvenancePredicateV02) GetMaterials() []*NormalizedMaterial

Implement NormalizablePredicate interface

type RendererCommon

type RendererCommon struct {
	// contains filtered or unexported fields
}

type RendererV01

type RendererV01 struct {
	*RendererCommon
}

func NewChainloopRendererV01

func NewChainloopRendererV01(att *v1.Attestation, builderVersion, builderDigest string) *RendererV01

func (*RendererV01) Header

func (r *RendererV01) Header() (*in_toto.StatementHeader, error)

func (*RendererV01) Predicate

func (r *RendererV01) Predicate() (interface{}, error)

type RendererV02

type RendererV02 struct {
	*RendererCommon
}

func NewChainloopRendererV02

func NewChainloopRendererV02(att *v1.Attestation, builderVersion, builderDigest string) *RendererV02

func (*RendererV02) Header

func (r *RendererV02) Header() (*in_toto.StatementHeader, error)

func (*RendererV02) Predicate

func (r *RendererV02) Predicate() (interface{}, error)

type SLSACommonProvenanceMaterial

type SLSACommonProvenanceMaterial struct {
	*slsacommon.ProvenanceMaterial
}

Jump to

Keyboard shortcuts

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