...

Source file src/github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.1/provenance.go

Documentation: github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.1

     1  package v01
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/common"
     7  )
     8  
     9  const (
    10  	// PredicateSLSAProvenance represents a build provenance for an artifact.
    11  	PredicateSLSAProvenance = "https://slsa.dev/provenance/v0.1"
    12  )
    13  
    14  // ProvenancePredicate is the provenance predicate definition.
    15  type ProvenancePredicate struct {
    16  	Builder   common.ProvenanceBuilder    `json:"builder"`
    17  	Recipe    ProvenanceRecipe            `json:"recipe"`
    18  	Metadata  *ProvenanceMetadata         `json:"metadata,omitempty"`
    19  	Materials []common.ProvenanceMaterial `json:"materials,omitempty"`
    20  }
    21  
    22  // ProvenanceRecipe describes the actions performed by the builder.
    23  type ProvenanceRecipe struct {
    24  	Type string `json:"type"`
    25  	// DefinedInMaterial can be sent as the null pointer to indicate that
    26  	// the value is not present.
    27  	DefinedInMaterial *int        `json:"definedInMaterial,omitempty"`
    28  	EntryPoint        string      `json:"entryPoint"`
    29  	Arguments         interface{} `json:"arguments,omitempty"`
    30  	Environment       interface{} `json:"environment,omitempty"`
    31  }
    32  
    33  // ProvenanceMetadata contains metadata for the built artifact.
    34  type ProvenanceMetadata struct {
    35  	// Use pointer to make sure that the abscense of a time is not
    36  	// encoded as the Epoch time.
    37  	BuildStartedOn  *time.Time         `json:"buildStartedOn,omitempty"`
    38  	BuildFinishedOn *time.Time         `json:"buildFinishedOn,omitempty"`
    39  	Completeness    ProvenanceComplete `json:"completeness"`
    40  	Reproducible    bool               `json:"reproducible"`
    41  }
    42  
    43  // ProvenanceComplete indicates wheter the claims in build/recipe are complete.
    44  // For in depth information refer to the specifictaion:
    45  // https://github.com/in-toto/attestation/blob/v0.1.0/spec/predicates/provenance.md
    46  type ProvenanceComplete struct {
    47  	Arguments   bool `json:"arguments"`
    48  	Environment bool `json:"environment"`
    49  	Materials   bool `json:"materials"`
    50  }
    51  

View as plain text