slsa

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// GithubHostedActionsBuilderID is a default builder ID for Github hosted actions.
	GithubHostedActionsBuilderID = "https://github.com/Attestations/GitHubHostedActions@v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildType

type BuildType interface {
	// URI returns the build type's URI.
	URI() string

	// Subject returns a set of artifacts created by the build.
	Subject(context.Context) ([]intoto.Subject, error)

	// BuildConfig returns the buildConfig for this build type.
	BuildConfig(context.Context) (interface{}, error)

	// Invocation returns an invocation for this build type.
	Invocation(context.Context) (slsa.ProvenanceInvocation, error)

	// Materials returns materials as defined by this build type.
	Materials(context.Context) ([]slsa.ProvenanceMaterial, error)

	// Metadata returns a metadata about the build.
	Metadata(context.Context) (*slsa.ProvenanceMetadata, error)
}

BuildType implements generation of buildType specific elements of SLSA provenance. Each BuildType instance represents a specific build.

type ClientProvider

type ClientProvider interface {
	OIDCClient() (*github.OIDCClient, error)
	GithubClient(context.Context) (*githubapi.Client, error)
}

ClientProvider creates Github API clients.

type DefaultClientProvider

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

DefaultClientProvider provides a default set of clients based on the Github Actions environment.

func (*DefaultClientProvider) GithubClient

func (p *DefaultClientProvider) GithubClient(ctx context.Context) (*githubapi.Client, error)

GithubClient returns a Github API client authenticated with the token provided in the github context.

func (*DefaultClientProvider) OIDCClient

func (p *DefaultClientProvider) OIDCClient() (*github.OIDCClient, error)

OIDCClient returns a default OIDC client.

type GithubActionsBuild

type GithubActionsBuild struct {
	Context github.WorkflowContext
	Clients ClientProvider
	// contains filtered or unexported fields
}

GithubActionsBuild is a basic build type for builders running in GitHub Actions.

func NewGithubActionsBuild

func NewGithubActionsBuild(s []intoto.Subject, c github.WorkflowContext) *GithubActionsBuild

NewGithubActionsBuild returns a new GithubActionsBuild that uses the GitHub context to generate information.

func (*GithubActionsBuild) BuildConfig

func (b *GithubActionsBuild) BuildConfig(context.Context) (interface{}, error)

BuildConfig implements BuildType.BuildConfig.

func (*GithubActionsBuild) Invocation

Invocation implements BuildType.Invocation. An invocation is returned that describes the workflow run. TODO: Document the basic invocation format.

func (*GithubActionsBuild) Materials

Materials implements BuildType.Materials. It returns a list of materials that includes the repository that triggered the GitHub Actions workflow.

func (*GithubActionsBuild) Metadata

Metadata implements BuildType.Metadata. It specifies that parameters are complete.

func (*GithubActionsBuild) Subject

Subject implements BuildType.Subject.

func (*GithubActionsBuild) WithClients

WithClients overrides the build type's default client provider. This is useful for tests where APIs are not available.

type HostedActionsGenerator

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

HostedActionsGenerator is a SLSA provenance generator for Github Hosted Actions. Provenance is generated based on a "build type" which defines the format for many of the fields in the provenance metadata. Builders for different ecosystems (languages etc.) can implement a build type from scratch or by extending GithubActionsBuild.

func NewHostedActionsGenerator

func NewHostedActionsGenerator(bt BuildType) *HostedActionsGenerator

NewHostedActionsGenerator returns a SLSA provenance generator for the given build type.

func (*HostedActionsGenerator) Generate

Generate generates an in-toto provenance statement in SLSA v0.2 format.

func (*HostedActionsGenerator) WithClients

WithClients overrides the default ClientProvider. Useful for tests where clients are not available.

type NilClientProvider

type NilClientProvider struct{}

NilClientProvider does not provide clients. It is useful for testing where APIs are not available.

func (*NilClientProvider) GithubClient

func (p *NilClientProvider) GithubClient(context.Context) (*githubapi.Client, error)

GithubClient returns nil for the client.

func (*NilClientProvider) OIDCClient

func (p *NilClientProvider) OIDCClient() (*github.OIDCClient, error)

OIDCClient returns nil for the client.

type WorkflowParameters

type WorkflowParameters struct {
	// EventInputs is the inputs for the event that triggered the workflow.
	EventInputs interface{} `json:"event_inputs,omitempty"`
}

WorkflowParameters contains parameters given to the workflow invocation.

Jump to

Keyboard shortcuts

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